Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>
img.one {
    height: auto;
}


img.two {
    height: 120px;
    width: 120px;
}


p.ex {
    height: 100px;
    width: 100px;
    border: 1px solid #73AD21;
}

</style>
</head>
<body>

<h2>Set height and width of Elements:</h2>

<p>Original image:</p>
<img class="one" src="ocean.jpg" width="300" height="300"><br>

<p>Sized image (in px):</p>
<img class="two" src="ocean.jpg" width="300" height="300"><br>

<p class="ex">The height and width of this paragraph is 100px.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy