DEV Community

Cover image for Daily Code 63 | CSS Display Property (🟥 HTML & 🟦 CSS Course 5)
Gregor Schafroth
Gregor Schafroth

Posted on

Daily Code 63 | CSS Display Property (🟥 HTML & 🟦 CSS Course 5)

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

Today we looked at different CSS Display Properties

  • Block elements take up a whole line (e.g. <p>)
  • Inline-block elements take up only as much space as they need to (e.g. <img>, <input>)
  • inline-elements appear within a line of text (e.g. <strong>)

My Code

The code shows how to change a block element to an inline-block element and the other way around. It’s not complicated but very good for me to know, so that was another nice short lesson :)

<!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;
    }

    .video-title {
      width: 300px;
    }

    .video-author,
    .video-stats {
      display: inline-block;
    }
  </style>
</head>

<body>
  <input class="search-bar" type="text" placeholder="Search">
  <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>
</body>

</html>
Enter fullscreen mode Exit fullscreen mode

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay