Most used CSS properties
Most used CSS properties
Introduction
Hello,
In this section, we will learn the most common CSS properties.
Until now, we have usually done examples with simple properties such as color, font-size.
Width Height
Height - Width
We will use width and height properties to set the width and height values of our elements.
There are two issues to be aware of here.
- We cannot assign width and height to inline-type elements.
- The width-height properties that we assign are by default independent of other properties such as margin, padding, and border. And it is used only for the area inside the element.
We will provide additional information on the above exceptions later.
<!DOCTYPE html>
<html>
<head>
<style>
.my-box {
width: 100px;
height: 100px;
background-color: blue;
color: white;
}
</style>
</head>
<body>
<div class="my-box">My Box</div>
</body>
</html>