Issue in Challenge Project: Company Home Page with Flexbox

Hello, I wanna know how can I make the background color connected as pic 2 .

Pic1
螢幕擷取畫面 2023-04-15 141413

Pic2

HTML

<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Damion" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Rubik" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600,700" rel="stylesheet">
   <link rel="stylesheet"  href="styles.css" /> 
  <meta charset="UTF-8">
</head>
<body>
  <!-- Header -->
  <header>
    <div class="content">
      <h1>The VC Experience</h1>
      <nav class="desktop">
        <ul>
          <li><a href="#">Mission Statement</a></li>
          <li><a href="#">Portfolio</a></li>
          <li><a href="#">Investment Team </a></li>
        </ul>
      </nav>
      </div>
      <div class="intro content">
        <h2 >The VC Experience</h2>
        <h4>Our fund is committed to the furthering entrepreneurs in the mobility sector.</h4>
      </div>
  </header>

CSS

.content{
    margin: 0;
    font-family: "Lexend Mega", sans-serif;
    color: black;
    background-color: white;
    font-size: 22px;
    text-align: center;
}

h1{
    display: block;
    font-size: 2em;
    margin-block-start: 0.83em;
    margin-block-end: 0.83em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
}

header li{
  display:inline-block;
  padding-left:40px;
  padding-right:40px;
  justify-content:space-around;
  text-decoration: underline;
  align-items: center;
    }

  .intro{
       height: 300px;
    background-image: url(https://content.codecademy.com/PRO/independent-practice-projects/flexbox-business-site/img/skyscrapers.jpg);
        background-repeat: no-repeat;
    background-size: cover;
     align-items: center;
         width:100%;
    margin:auto;
    padding-top:35px;
  }

  h2,h3,h4,p{
    margin:auto;
    padding:20px;
    background-color:white;
     }

h2 {
    display: block;
    font-size: 1.5em;
    margin-block-start: 1.5em;
    margin-block-end: 1.5em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
    }

h4 {
    display: block;
    margin-block-start: 1.33em;
    margin-block-end: 1.33em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    font-weight: bold;
}

Hi. Your problem comes from the lines margin-block-end: 1.5em; in h2 and margin-block-start: 1.33em; in h2. If you take them out, the h2 and h4 are together.

2 Likes