CSS maxheight Property (original) (raw)

CSS max-height Property

Last Updated : 28 Aug, 2024

The max-height property in CSS is used to set the maximum height of an element. If the content of the element is larger than the specified maximum-height then the content will overflow otherwise it has no effect. If the content of the element is smaller then it has no effect. The height property value can be overridden by the max-height property.

**Syntax:

max-height: none|length|initial|inherit;

**Property values:

**Example: In this example, we are using the max-height: none property.

html `

max-height property
<style>
    p {
        max-height: none;
        border: 1px solid black;
        overflow: auto;
    }
</style>

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.

`

**Output: max-height

**Example: In this example, we use max-height: length; property.

html `

max-height property
<style>
    p {
        max-height: 35px;
        border: 1px solid black;
        overflow: auto;
    }
</style>

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.

`

**Output: max-height

**Example: In this example, we are using max-height: initial property.

html `

max-height property
<style>
    p {
        max-height: initial;
        border: 1px solid black;
        overflow: auto;
    }
</style>

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.

`

**Output: max-height

**Supported Browsers: The browser supported by _max-height property are listed below: