WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

CSS Layout - The display Property


CSS Dimension Properties

height

The height property sets the height of the element.

Note: The height attribute does not include padding, borders, or margins!

Default: auto
Inheritance: no
Version: CSS1
JavaScript syntax: object .style.height = "50px"


Browser support

The numbers in the table indicate the first browser version number that supports this attribute.

property
height 1.0 4.0 1.0 1.0 7.0

Attribute value

value Description
auto The default. The browser calculates the actual height.
length Use px, cm and other units to define the height.
% Based on the percentage height of the block-level object that contains it.
inherit Specifies that the value of the height attribute should be inherited from the parent element.


Example

p.ex
{
height:100px;
width:100px;
}

Try it yourself »


Setting max-width

The

max-width attribute sets the maximum width of the element.

Note: The max-width property does not include padding, borders, or margins!

Default: none
Inheritance: no
Version: CSS2
JavaScript syntax: object .style.maxWidth = "100px"


Browser support

The numbers in the table indicate the first browser version number that supports this attribute.

property
max-width 1.0 7.0 1.0 2.0.2 7.0

Attribute value

value Description
none The default. There is no limit to the maximum width of an element.
length Defines the maximum width value of the element.
% Defines the maximum width based on the percentage of the block-level object that contains it.
inherit Specifies that the value of the max-width attribute should be inherited from the parent element.


Example

p
{
max-width:100px;
}

Try it yourself »