#image should be centered within its parent

Tell us what’s happening:
This is the error i get:
Your #image should be centered within its parent.
this error still shows even though i copy and pasted all the html and CSS code of freecodecamp’s sample tribute page. i think the error is not my code there must be something else.

   **Your code so far**
/* file: index.html */
<!DOCTYPE html>
<html>
<head>
	<title>Wine Benefits</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
	<main id="main">
		<h1 id="title">Wine</h1>
		<p>Benefits of wine</p>
		<figure id="img-div">
			<img id="image" alt="wine pic" src="https://en.wikipedia.org/wiki/File:Abhar-iran.JPG"/>
		<figcaption id="img-caption">
			A beautiful fresh grape from a tree
		</figcaption>
		</figure>

		<section id="tribute-info">
			<ul>
				<li><p><span>#1 - </span>Rich in antioxidants.</p></li>
				<li><p><span>#2 - </span>Lowers bad cholesterol.</p></li>
				<li><p><span>#3 - </span>Keeps heart healthy.</p></li>
				<li><p><span>#4 - </span>Regulates blood sugar.</p></li>
				<li><p><span>#5 - </span>Reduces the risk of cancer.</p></li>
				<li><p><span>#6 - </span>Helps treat common cold.</p></li>
				<li><p><span>#7 - </span>Boosting heart, gut, and brain health.</p></li>
				<li><p><span>#8 - </span>Keeps you slim.</p></li>
				<li><p><span>#9 - </span>Keeps memory sharp.</p></li>
				<li><p><span>#10 - </span>Reduces the risk of cardiovascular disease and heart attacks</p></li>
			</ul>
			
			<p id="link-paragraph">If you want to read more click <a id="tribute-link" target="_blank" href="">here</a></p>
		</section>
	</main>
</body>
</html>
/* file: styles.css */
	* {
			margin: 0;
			padding: 0;
		}
		body {
			padding: 1em;
		}
		#image {
			display: block;
			max-width: 100%;
 			margin: 0 auto;
			min-width: 300px;
			/* The image should be centered within its parent */
		
		}
		#img-div {
			background: white;
		}
		#img-caption {
			font-family: sans-serif;
			font-size: 32px;
			margin-left: 20%;
		}
		#title {
			text-align: center;
			margin: 0 0 .5em 0;
		}
		p {
			font-family: sans-serif;
			margin-bottom: 2em;
		}
		span {
			font-weight: bold;
		}
		ul {
			word-break: break-all;
			margin-left: 1em;
		}

		#link-paragraph {
			text-align: center;
			margin-top: 1em;
		}

		@media(max-width: 1000px)
		{
			#img-caption {
				margin-left: 0;
			}
		}

		#tribute-link {
			text-decoration: none;
			font-style: italic;
			color: #A11;
		}
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Challenge: Build a Tribute Page

Link to the challenge:

1 Like

Hi @betelhemyemanezoom

Great job! I am far behind you.

You have a bug there. You are linking to a page with an image, no direct to the image. The correct link is this one:

I left this code and it works, it says you pass:

#image {
			display: block;
			max-width: 100%;
 			margin: 0 auto;
			/* The image should be centered within its parent */
		
		}

Congrats!!! :muscle:

1 Like

It works Thank You a LOT!!!