width: ***; height: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The width property specifies the width of an element, and the height property specifies the height of an element.


div {
width: 80%;
height: 100px;
}

Property Value Explanation
width length, %, or auto the size of the width
height length, %, or auto the size of the height

The default is "auto".

Example


<html>
<head>
<title>TAG index</title>

<style type="text/css">

div {
width: 50%;
height: 100px;
background-color: #85b9e9;
}

p {
width: 50%;
background-color: #ffd78c;
}

</style>

</head>
<body>

<div>width:50%, height:100px</div>

<p>width:50%</p>

<div>
<p>width:50%</p>
</div>

</body>
</html>

Output
width:50%, height:100px

width:50%

width:50%