The CSS height and CSS width properties allow you to set the height and width of an element. These properties can hold following values: length: The height and width of any div or html parts that hold content can be added to images and videos as well. Devsocial.net offers free online tutorials, references and free SEO Tools the world wide web design library.
Properties | Description |
height |
The height property sets the height of the HTML element. |
width |
The width property sets the width of the HTML element. |
line-height |
The line-height property sets the height of a line of a text. |
max-height |
The max-height property sets the maximum height that an element can be. |
min-height |
The min-height property sets the minimum height that an element can be. |
max-width |
The max-width property sets the maximum width of an element. |
min-width |
The min-width property sets the minimum width of an element. |
Height
and Width
ValuesThe CSS height and width property consist of the following values:
Value | Description |
auto |
This is the default value of both properties. |
length |
The user can set the height and width of the box in px, cm, etc. |
% |
The user can set the value of the height and width in % according to their containing block |
initial |
This value sets the value of the height and width to its default value. |
inherit |
This value inherits the value of height and width property from its parent element. |
Max-Width
of a box in CSSThe max-width property is used to set the max-width of any element. The values of this property can be specified in length, cm, px, %, etc. This property is used to overcome the problem that occurs when the user resizes the screen which is smaller than the element's height and width then the browser adds the side scroll bar to the web page. So, this property improves the handling of the elements when the user switches to the smaller window.
In this lesson we have learned about the various values of the CSS height and width property. Also we have learned how to set max-height and max-width of an HTML elements.
Capable:
Note: Make sure your page contains a valid doctype for this menu to render properly.
Revision History: Nov 8th, 2023': updated code..
Usage Terms: | Please Read - -> >
Viewed: 60,140
Share our library with others. Spread the love. Share:
Was this article & Examples Helpful ?
If so you can help us bring this and more to become available for you at anytime. You can help us by donating any amount or Sharing & Following Us. Donate through PayPal.
More useful links: