Width and height part 2

The Minimum and Maximum Sizes



To set the minimum and maximum height and width of an element, you can use the following properties:

min-width - the minimum width of an element
min-height - the minimum height of an element
max-width - the maximum width of an element
max-height - the maximum height of an element

In the example below, we set the minimum height and maximum width of different paragraphs to 100px. 

The HTML:<p class="first">The <strong>minimum height </strong> of this paragraph is set to 100px.</p>
<p class="second">The<strong> maximum width </strong> of this paragraph is set to 100px.</p>

The CSS:
p.first {
border: 5px solid green;
min-height: 100px;
}
p.second {
border: 5px solid green;
max-width: 100px;
}
Try It Yourself

Result:
Tap Try It Yourself to play around with the code!

Comments

Popular posts from this blog

font-family part 1