Supporting section alignment (the "go premium" section)


#1

I’ve used text-align: center; to nicely align all of the content for the MOVE project. However, the second to last section - the black supporting section with the “Go Premium” text and link refuses to budge. I’ve inspected the original page, and it seems like text-align should do the trick. Any advice as to what I’m doing wrong?

    <div class="supporting">
      <div class="container">
        <div class="col">
          <h2>Go Premium</h2>
          <p>Receive recommendations based on your activity to level up.</p>
          <a href="#" class="btn">LEARN MORE</a>
        </div>
        <div class="clearfix"></div>
      </div>
    </div>

*****AND THE CSS********
/* Supporting */
.supporting {
  text-align: center;
  padding: 50px 0 80px;
  background-color: #1c1c1c;
  
}

.supporting .col {
  float: left;
  width: 28%;
  padding: 10px;
}

.supporting h1,
.supporting h2 {
  color: #ffa800;
  font-size: 20px;
  margin-bottom: 10px;
 
}

.clearfix {
  clear: both;
}

.supporting p {
  color: #efefef;
  margin-bottom: 20px;
  line-height: 20px;
  font-size: 12px;
}

.supporting .btn {
  background-color: #eee;
  color: #1c1c1c;
  font-size: 18px;
  padding: 8px 30px;
  text-decoration: none;
  display: inline-block;
}




#2

the h2 heading is perfectly in the center of its parent element? What seems to be the problem?


#3

When I look at the browser everything in the “Go Premium” section still isn’t centred.


#4

you didn’t include enough code to trouble shoot the problem, please include your full html and css code


#5

Ah apologies, really appreciate your help with this.

<div class="main">
  <div class="container">
    <h1>Move</h1>
    <p>Form healthy habits to take your fitness to the next level.</p>
    <a href="#" class="btn">START NOW</a>
  </div>
</div>

<div class="supporting">
  <div class="container">
    <div class="col">
      <h2>Move</h2>
      <p>Become more active by tracking your runs, rides, and walks.</p>
    </div>
    <div class="col">
      <h2>Sync</h2>
      <p>Access your activity on your phone, tablet or computer</p>
    </div>
    <div class="col">
      <h2>Compete</h2>
      <p>Set personal challenges and see how you rank against friends</p>
    </div>
    <div class="clearfix"></div>
  </div>
</div>


<div class="feature">
  <div class="container">
    <h1>MOVE.REST.RECOVER.MOVE</h1>
  </div>
</div>

    <div class="supporting">
  <div class="container">
    <div class="col">
      <h2>Go Premium</h2>
      <p>Receive recommendations based on your activity to level up.</p>
      <a href="#" class="btn">LEARN MORE</a>
    </div>
    <div class="clearfix"></div>
  </div>
</div>

<div class="footer">
  <h1>Stop Scrolling. Start Moving.</h1>
  <a href=# class="btn">START NOW</a>
</div>
html, body {
  margin: 0;
}

h1, h2, a {
  font-family: 'Oswald', sans-serif;
}

p {
  font-family: Helvetica, Arial, sans-serif; 
}

.container {
  width: 940px;
  margin: 0 auto;
}

/* Main */
.main {
  height: 600px;
  background: url(https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg) no-repeat center;
  text-align: center;
}

.main h1 {
  font-size: 150px;
  color: white;
}

.main p {
  font-size: 18px;
  color: white;
  
}

.btn {
  color: white;
  background-color: black;
  text-decoration: none;
  padding: 15px;
}

.btn:hover {
  color: orange;
}

/* Supporting */
.supporting {
  text-align: center;
  padding: 50px 0 80px;
  background-color: #1c1c1c;
}

.supporting .col {
  float: left;
  width: 28%;
  padding: 10px;
}

.supporting h1,
.supporting h2 {
  color: #ffa800;
  font-size: 20px;
  margin-bottom: 10px;
}

.clearfix {
  clear: both;
}

.supporting p {
  color: #efefef;
  margin-bottom: 20px;
  line-height: 20px;
  font-size: 12px;
}

.supporting .btn {
  background-color: #eee;
  color: #1c1c1c;
  font-size: 18px;
  padding: 8px 30px;
  text-decoration: none;
  display: inline-block;
}

/* Feature */
.feature {
  text-align: center;
  height: 600px;
  background: url(https://s3.amazonaws.com/codecademy-content/projects/move/feature.jpg) no-repeat center center;
}

.feature h1,
.feature h2 {
  color: #fff;
  font-size: 40px;
  margin: 0;
  padding:50px 0 0;
}

/* Footer */
.footer {
  height: 600px;
  background: url(https://s3.amazonaws.com/codecademy-content/projects/move/footer.jpg) no-repeat center center;
  text-align: center;
}

.footer h1,
.footer h2 {
  color: #fff;
  font-size: 40px;
  margin: 0 0 20px 0;
  padding:50px 0 0;
}

.footer p {
  color: #fff;
  margin: 0 0 20px 0;
  font-size: 18px;
}


@media (min-width:600px) {
  .main h1 {
    font-size: 200px;
  }

  .supporting .col {
    width: 30%;
  }

  .supporting h2 {
    font-size: 40px;
  }

  .supporting p {
    font-size: 14px;
  }

  .feature h2 {
    font-size: 60px;
  }
}

#6

<div class="col"> is limiting the content inside it, given it only has a width of 28 percent.

so either the col should be wider, or col should be centered


#7

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