Setting the Width of an HTML Element Box

You can use the width property to set the width of an HTML, element box. The width of an HTML element box can be specified in units, such as pixels, inches, centimeters, or points or in the form of a percentage value.

Let’s do the following steps to set the width of an HTML element box:


<!DOCTYPE html>
<html>
<head>
<title>Setting the width of an HTML Element Box</title>
    <style type=”text/css”>
    div {border: thin dashed #ff0000; height: 300px; width: 200px}
    </style>
</head>
<body>
    <div>
    <h4>Here is a list of students:</h4>
    <ul>
    <li>Sumit Saxena</li>
    <li>Amitabh Kumar </li>
    <li>Rohit Jandial</li>
    <li>Jitendra Arya</li>
    <li>Avantika Srivastava</li>
    <li>Sanchita Sarkar</li>
    </ul>
    </div>
</body>
</html>

Save the document with the name Width.html and open with browser.