css page width code example

Example 1: width css property

/* <length> values */
width: 300px;
width: 25em;

/* <percentage> value */
width: 75%;

/* Keyword values */
width: max-content;
width: min-content;
width: fit-content(20em);
width: auto;

/* Global values */
width: inherit;
width: initial;
width: unset;

Example 2: fixed size body html

html {
    position: relative;
    min-width: 1024px;
    min-height: 768px;
    height: 100%;
}
<!-- Remove height 100% if needed fixed height -->

Example 3: width css

/*Based on viewport*/
width: 100vh;
width: 100vw;

Tags:

Css Example