I have a simple problem with an image going under text, rather than beside it.
Markup is like this:
<div class="footer">
<p>bla bla bla bla</p>
<a href="url_here" class="next" title="Next"><span>Next</span></a>
</div>
CSS is like this:
div.footer p {
color: #FFF;
width: 80%;
margin: 0 auto;
padding:0;
border: 1px solid white;
}
div.footer a.next {
background-repeat:no-repeat;
display: block;
float: left;
margin-left: 2em;
height: 52px;
width: 24px;
background-image: url('../gfx/arrow-right.jpg');
margin-left: .7em;
}
div.footer a.next span {
display: none;
}
The paragraph seems to want to push the link below it, rather than floating in the free space beside it. Any ideas? The <p> is only 80% wide, so it’s got a lot of space to display the link.
Cheers
The paragraph is a block level element and will force itself to be on a new line after the last element and force the next element to be on a new line.
if you want the link on the left (you have a float :left on the anchor) try floating the paragraph to the right.
try
see http://jsfiddle.net/2PXt6/1/
if you want the anchor to float to the right of the paragraph, move the anchor to be before the paragraph and put a float: right on the anchore tag.
EDIT:
To have the anchor on the Right have the anchor first in the html and float:right see
http://jsfiddle.net/2PXt6/4/
if you do not want to change the html, float the paragraph to the left and the anchor to the left. see http://jsfiddle.net/2PXt6/5/