1/* <length> values */
2width: 300px;
3width: 25em;
4
5/* <percentage> value */
6width: 75%;
7
8/* Keyword values */
9width: max-content;
10width: min-content;
11width: fit-content(20em);
12width: auto;
13
14/* Global values */
15width: inherit;
16width: initial;
17width: unset;
1html {
2 position: relative;
3 min-width: 1024px;
4 min-height: 768px;
5 height: 100%;
6}
7<!-- Remove height 100% if needed fixed height -->
1<div style="background-color:navy;">
2 <div style="width:50%; margin-left:20%; background-color:chartreuse;">
3 Width: 50%, Left margin: 20%
4 </div>
5 <div style="width:30%; margin-left:60%; background-color:pink;">
6 Width: 30%, Left margin: 10%
7 </div>
8</div>
9
1The width property in CSS specifies the width of the element's content area. This “content” area is the portion inside the padding, border, and margin of an element (the box model).