Tribute Page - Build a Tribute Page

I’ve been trying to make my #image tag centered in its parent and I don’t know how to do it

Your code so far

<!-- file: index.html -->
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
  <main id="main">
    <h1 id="title">DR. NORMAN BORLAUG</h1>
    <div id="img-div">
      <img id="image"> 
      <figcaption id="img-caption">BAD GUY</figcaption> 
      <h2 id="tribute-info">The life of a great man</h2>
      <a href="http://gmail.com/" target="_blank" id="tribute-link">Click here for more on our client</a>
    </div>

  </main>
</body>
</html>

/* file: styles.css */
#image{
  max-width:100%;
  height:auto;
  width:100%;
  

}
#img-div{
  width:50%;
  height:auto;
  
}

img{
  display:block;
}

Your browser information:

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

Challenge: Tribute Page - Build a Tribute Page

Link to the challenge:

I copied your code into the challenge and didn’t have any issue submitting it…
But also I didn’t see any images?

But in general you can try to set the margin-left and margin-right to auto on the image and its display to block, and also text-align: center and these properties work for centering together.

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