homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

text align with img floating

 3:38 pm on Apr 4, 2004 (gmt 0)

Is there any way to use CSS to get my text to align to the right when using image float. I have
{ float: left; border: inset 6px #939; margin-right: 10px; }
/* left img float */
{ float: right; border: inset 6px #939; margin-left: 10px; }
/* right img float */
but can not figure out how to get the text on the right float to align right with out doing it in HTML over and over



 4:18 pm on Apr 4, 2004 (gmt 0)

Have you tried wrapping the text in a div or p and giving it the property of text-align: right;


 10:07 pm on Apr 4, 2004 (gmt 0)

yep the only way i could get it to work so far is with the html coding <p align="right> tags i was trying to do it thru css so i dont have to code it every where i need it, Thanks


 10:34 pm on Apr 4, 2004 (gmt 0)

I've been grappling with this one lately. This site had some good info on image captions [simplebits.com].

The best solution I have so far is:

<div class="imgright"> 
<img src=etc. etc.>
<br />
<span>Caption here</span>

This requires a "float:right" for div.imgright, plus whatever formatting you want on the div or the caption (span).

You can use <p> tags for the caption but this won't work nicely under IE 5.2 for Mac. The break/span combination is a bit messy but works best across multiple browsers IMHO.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved