DEV Community

AKSH DESAI
AKSH DESAI

Posted on

CSS Margin Tutorial

Code

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    h1 {
      margin: 50px auto;
      border: 3px solid red;
      width: 450px;
      text-align: center;
    }

    #first {
      border: 1px solid black;
      margin-bottom: 30px;
    }

    #second {
      border: 2px solid red;
      margin: 30px 200px 10px 300px;
    }
  </style>
</head>

<body>
  <h1> Yahoo Baba CSS Margin </h1>

  <div id="first">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Rem est tempora sed provident vitae soluta accusantium eveniet laborum, voluptates similique quas molestiae ullam natus nobis porro iste? Quam, a ratione.
  </div>

  <div id="second">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos consectetur inventore suscipit voluptas qui, magnam aliquam, unde ab et alias natus sed nobis, saepe voluptates. Doloremque facilis fugiat hic incidunt!
  </div>

  Lorem ipsum dolor sit, amet consectetur adipisicing elit. Rerum molestiae perspiciatis eos possimus quis consequuntur temporibus tenetur soluta totam itaque!
</body>

</html>
Enter fullscreen mode Exit fullscreen mode

Output
Output

Thank You.
You can follow us on:
Youtube
Instagram

Top comments (0)