Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Alexey Tseitlin
5,866 Points<p></p> problem
The problem is when I add the "P" tag. The image stops honoring the " top:30%;" found in css ID "#viewimage"..... Why is that?
<div id="overlay">
<img id="viewimage" src="http://port-80-kp53ji7d7z.treehouse-app.com/images/refferal_machine.png">
<p>584684</p>
</div>
#overlay {
background: rgba(0,0,0,0.5);
width: 100%;
height: 100%;
position:absolute;
left: 0;
top: 0;
text-align:center;
}
#viewimage {
position:relative;
top:30%;
}
3 Answers
Ayoub AIT IKEN
12,314 Pointsyou probably should do that with a margin top ;) !
#viewimage {
position:relative;
margin-top:30%;
}
PS : did you append your altext to your alt, cause in your previous post, you werent appending it.
$("#imageGallery li a").click(function(event){
event.preventDefault();
var imageURL = $(this).attr("href");
console.log(imageURL);
$image.attr('src',imageURL);
var alttext = $(this).children("img").attr("alt");
console.log(alttext);
$alt.text(alttext); // Here you are putting your altext into the "p" Tag
$overlay.show();
});
Patrick Ho
Courses Plus Student 6,412 PointsHi Alexey Tseitlin, I not Sure what I can help, but u try to remove
#viewimage {
position:relative;
top:30%;
}
into this
#viewimage {
margin-top:30%;
}
or
#overlay img {
margin-top:30%;
}
remove the viewimage ID
try and see it is work for you?
Ayoub AIT IKEN
12,314 Pointsglad to help
Alexey Tseitlin
5,866 PointsAlexey Tseitlin
5,866 PointsAdded " margin-top:30%;" - Didn't help =(
Alexey Tseitlin
5,866 PointsAlexey Tseitlin
5,866 PointsThanx a lot