CSS Height and Width

CSS includes height and width properties to help you specify the size of your elements.



'height' and 'width' Properties


Applies to all HTML elements except non-replaced inline elements, table columns and column groups.


Can use a fixed height (i.e. pixels) or a percentage height.





<div style="background-color:orange;height:125px;width:75px;">

This div has height and width applied.
</div>



This results in:




This div has height and width applied.



'max-height' and 'max-width' Properties


Enables you to constrain the height and/or width of an element to a maximum value.





<div style="background-color:orange;max-height:125px;max-width:75px;">
This div has max-height and max-width applied.
</div>



This results in:





This div has max-height and max-width applied.



'min-height' and 'min-width' Properties


Enables you to constrain the height and/or width of an element to a minimum value.





<div style="background-color:orange;min-height:125px;min-width:75px;">
This div has min-height and min-width applied.
</div>




This results in:




This div has min-height and min-width applied.




0 ความคิดเห็น:

แสดงความคิดเห็น