Hi everyone,
I was confused why I can’t pass the test for the following requirement:
1.Your img element should have a display of block
2.Your #image should have a max-width of 100%
3.Failed:Your #image should be centered within its parent
Expecaily, for the requirement three. What’s "within its parent?
What should I target?
Thank you in advanced.
Will
Your code so far
<!-- file: index.html -->
<DOCTYPE html>
<html lan="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Build a Tribute Page">
<link rel="stylesheet href="styles.css">
</head>
<main id="main">
<title id="title">Dr. Norman Borlaug </title>
<h1>Dr. Norman Borlaug</h1>
<p>The man who saved a billion lives</p>
<div id="img-div">
<img id="image" src="https://images.pexels.com/photos/5256400/pexels-photo-5256400.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2">
<figcaption id="img-caption">Dr. Norman Borlaug, third from the left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.</figcaption>
</div>
<h2 id="tribute-info">What should I type</h2>
<p>If you have time, you should read more about this incredible human being on his <a href="wikipedia.com" id="tribute-link" target="_blank">Wikipedia</a> entry.</p>
</main>
<!--X Test error
Your img element should have a display of block
Your #image should have a max-width of 100%
Failed:Your #image should be centered within its parent -->
/* file: styles.css */
#img-div {
display: flex;
}
img {
display: block
}
#image {
max-width: 100%;
height: auto;
}
#img-caption {
}
#tribute-link {
}
#tribute-info {
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Tribute Page - Build a Tribute Page
Link to the challenge: