I have the following piece of html
code:
<ul>
<li>
<article>
<header>
<h2><a href='#'>WALL-E Review</a></h2>
<img src='images/featured01.jpg' alt="WALL-E">
</header>
<time datetime="2011-10-10"> 10 Octomber 2011 </time>
<p>What if mankind had to leave Earth, and somebody forgot to turn the last robot off?</p>
</article>
</li>
<li>
//contains another <article> similar to the first one
</li>
<li>
//contains another <article> similar to the first one
</li>
</ul>
I have to style this html
code without changing it using css
only so that the three articles appear next to each other. The <img>
elements should be above the <time>
elements and <time>
elements should be above the <p>
elements. Something like this: with image. If an image is missing though it looks like this: without image.
Here is the simplified version of the css
I use to style it and where I think I go wrong:
li {
float: left;
//some padding
}
time {
position: relative;
top: 8px;
}
p {
position: relative;
top: 16px;
}
Can you help me fix it so that the time and the description always appear at the same place even when the image is missing?