DEV Community

Cover image for Daily Code 64 | the <div> element (🟥 HTML & 🟦 CSS Course 6)
Gregor Schafroth
Gregor Schafroth

Posted on

Daily Code 64 | the <div> element (🟥 HTML & 🟦 CSS Course 6)

Once more I’m continuing with my HTML & CSS course today https://www.youtube.com/watch?v=G3e-cpL7ofc

  • <div> stands for division, but actually it’s just a box
  • <div> by defaylt is a block element
  • its so useful because any element can go inside. They are basically containers

My Code

Here is some code to show this. I think all makes sense

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

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>YouTube.com Clone</title>
  <style>
    .thumbnail {
      width: 300px;
      display: block;
    }

    .search-bar {
      font-size: 20px;
      margin: 12px 0px;
      display: block;
    }

    .video-title {
      width: 300px;
    }

    .video-preview {
      width: 300px;
      display: inline-block;
      vertical-align: top;
      margin-right: 15px;
    }
  </style>
</head>

<body>
  <input class="search-bar" type="text" placeholder="Search">
  <div class="video-preview">
    <img class="thumbnail" src="thumbnails/thumbnail-1.webp" alt="">
    <p class="video-title">Talking Tech and AI with Google CEO Sundar Pichai!</p>
    <p class="video-author">Marques Brownlee</p>
    <p class="video-stats">3.4M views &#183; 6 months ago</p>
  </div>
  <div class="video-preview">
    <img class="thumbnail" src="thumbnails/thumbnail-2.webp" alt="">
    <p class="video-title">Try Not To Laugh Challenge #9</p>
    <p class="video-author">Markiplier</p>
    <p class="video-stats">19M views &#183; 4 years ago</p>
  </div>

</body>

</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)