Tribute Page - Build a Tribute Page

Tell us what’s happening:
Describe your issue in detail here. Please assist I am stuck, How do I centre within the parent?

Your code so farmain div img{display:block;}
height: auto;}

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en"
  <meta charset="UTF-8"
<link rel="stylesheet"href="styles.css">
<main  id="main"><nav id="title">FreecodeCamp</nav>
<div id="img-div"><img id="image"><figcaption id="img-caption">FreecodeCamp Description<p id ="tribute-info">People can learn coding<a id="tribute-link"target="_blank"href=""</a></p></main>
/* file: styles.css */

Your browser information:

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

Challenge: Tribute Page - Build a Tribute Page

Link to the challenge:

CSS-Tricks: Centering in CSS: A Complete Guide

Since you are turning the img element into a block display then an easy method would be to use auto side margins.

type or paste code here#image{img {display:block;}
{height: auto;}

This is not valid CSS.

its still giving error

type or paste code here img{display:block;}
{margin: auto;}
{height: auto;}

Slightly better but still not valid CSS. All rulesets need to have a selector.

{margin: auto;}

This is invalid because you haven’t specified what element(s) it should apply to.

ok, I have specified it to the img element, but the error message keeps coming up.

type or paste code here img{display:block;
margin: auto;}
{height: auto;}

You are getting closer. You’ve got an HTML problem you need to fix.

I have added the closing tag, same error.

type or paste code here <meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">

I’m assuming are referring to this failing test?

“Your #image should have a max-width of 100%.”

Show me in your CSS where you are setting max-width to 100% on the #image element.

1 Like

I have corrected it. Thanks a lot.

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