Design a Blog Post Card - Design a Blog Post Card

Tell us what’s happening:

It passes all the tests but I want to center it vertically like in the example project. How do I do that ?

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Blog Post Card</title>
    <link rel="stylesheet" href="styles.css" />
</head>

<body>

    <div class="blog-post-card">
        <img src="https://cdn.freecodecamp.org/curriculum/labs/cover-photo.jpg" alt="a hand typing on the keyboard of a laptop" class="post-img" />

        <div class="post-content">
            <h2 class="post-title">Learn Web Development in 2024</h2>
            <p class="post-excerpt">Stay ahead of the curve with the latest trends in web development. Discover what's new and exciting in 2024</p>
            <a class="read-more">Read More</a>
        </div>
    </div>


</body>

</html>
/* file: styles.css */


.blog-post-card{
  background-color: white;
  border-radius: 50px;
  width: 300px;
  text-align: center;
  margin: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.post-img{
  width: 100%;
  border-bottom: black solid 5px;
}

.post-content{
  padding: 10px;
}

.post-title{
  margin: 10px;
  color: black;
}

.post-excerpt{
  margin: 10px;
  color: grey;
}

.read-more{
  color: white;
  background-color: black;
  margin: 10px;
  padding: 10px;
  border-radius: 12px;
  display: inline-block;
}

.read-more:hover{
  background-color: grey;
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Design a Blog Post Card - Design a Blog Post Card
https://www.freecodecamp.org/learn/full-stack-developer/lab-blog-post-card/lab-blog-post-card

the example project uses flexbox, I am not sure that is something already introduced. You can make it more centered using margin tho

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.