set div width code example

Example 1: javascript set element width

document.getElementById("myElID").style.width = "100px";

Example 2: 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 3: how do i make a div full width with css

.row-full{
 width: 100vw;
 position: relative;
 margin-left: -50vw;
 height: 100px;
 margin-top: 100px;
 left: 50%;
}

Example 4: width css

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

Tags:

Html Example