CSS min-height Property

Thuộc tính min-height trong CSS dùng để thiết lập chiều cao tối thiểu cho một phần tử. Thuộc tính min-height được dùng khi nội dung nhỏ hơn giá trị này. Nếu nội dung lớn hơn min-height thì thuộc tính này không có tác dụng. Thuộc tính này đảm bảo giá trị của height không nhỏ hơn giá trị chỉ định.

Syntax:

min-height: length|initial|inherit; 

Property Value:

  • length: Thuộc tính này được dùng để đặt min-height. Giá trị mặc định của length là 0. Chiều cao có thể được đặt theo px, %, cm, v.v.
  • initial: Thuộc tính này dùng để đặt giá trị min-height về giá trị mặc định.
  • inherit: Thuộc tính này được kế thừa từ phần tử cha.

Example: Trong ví dụ này, chúng ta đang dùng thuộc tính min-height: length.

html
<!DOCTYPE html>
<html>
<head>
    <title>
        min-height property
    </title>

    <style>
        p {
            min-height: 10px;
            border: 1px solid black;
        }
    </style>
</head>

<body>
    <p>
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's
        & Coding question likely to be asked in the
        interviews & make your upcoming placement
        season efficient and successful.
    </p>
</body>
</html>

Output: css-min-height-property

Example: Trong ví dụ này, chúng ta đang dùng thuộc tính min-height: initial.

html
<!DOCTYPE html>
<html>
<head>
    <title>
        min-height property
    </title>

    <style>
        p {
            min-height: initial;
            border: 1px solid black;
        }
    </style>
</head>

<body>
    <p>
        Prepare for the Recruitment drive of product
        based companies like Microsoft, Amazon, Adobe
        etc with a free online placement preparation
        course. The course focuses on various MCQ's
        & Coding question likely to be asked in the
        interviews & make your upcoming placement
        season efficient and successful.
    </p>
</body>
</html>

Output: css-min-height-property

Supported Browsers: Các trình duyệt được hỗ trợ bởi thuộc tính min-height được liệt kê dưới đây:

  • Google Chrome 1.0
  • Edge 12.0
  • Firefox 3.0
  • Safari 1.3
  • Opera 4.0

Last Updated : 21/07/2025