Margin and Padding

Margin and Padding

Here we use some properties of css
1. Padding :- In box we use 4 types of padding. Padding left, Padding top, Padding bottom, Padding right. Padding property we use to set text position in box and we also use "box-sizing: border-box" because when we use padding our box height width not to increase.
2. Margin :- In css we use "Margin" to set margin of our box. Margin have also 4 types :- margin left, margin top, margin bottom, margin right.

Let's have an example to use this properties.

<html>
  <head>
   <title>CSS BOX</title>
   <style>
.a
{
  background-color:rgba(100,150,200);
  height:400px;
  width:400px;
  box-sizing:border-box;
  margin:50px 50px;
  padding:30px 30px;
}
  </style>
  </head>
  <body>
    
    <div class="a">Hyper Text Mark Up Language</div>
  </body>

  <html>

Comments

Popular Posts