Reply
How to float image to bottom right?
Old 06-29-2007, 11:10 AM How to float image to bottom right?
artcoder's Avatar
Skilled Talker

Posts: 83
Location: United States
Below is a picture of what I want to achieve...



See how there is a div around the text and picture. But I want the picture on the lower right.

Below is the code that I'm attempting to use ...

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style>
.panel {
 border: 1px solid #00c;
 margin: 20px 20px 0px 20px;
 background-color: white;
 padding: 0px;
 width: 300px;
}
</style>
</head>
<body>
<div class="panel">
There is some text here that I want to wrap around the picture which should be banked to the bottom right of this panel.
<br /><br />I want the text to fill the area of left of the happy face.<br /><br />
Right now, the happy face is taking up the whole bottom area.
<img src="happy.gif" style="float:right;" />
</div>
</body>
</html>

As you can see on this page, it is not coming out like I wanted. The text is not flowing down into the level of the picture.

Any suggestions?
artcoder is offline
Reply With Quote
View Public Profile Visit artcoder's homepage!
 
When You Register, These Ads Go Away!
Old 06-29-2007, 11:17 AM Re: How to float image to bottom right?
Riane's Avatar
Super Talker

Posts: 149
Name: Jordan
Location: Chicago, IL
You're just floating the image to the right, and not really specifying anything else for it to do.

What you can do is create a class the the image, say "bottom-right."

Code:
img.bottom-right{
    border: 0;
    padding: 0;
    margin-left: 10px;
    margin-top: 10px;
    float: right;
}
The margin left/top has a 10px which allows the text to wrap the image on the top and left side without running straight into the image. You can change it for more space or less space.

And in your image you would just have (remember with XHTML Trans 1.0, you have to list an alt attribute, as well as the closing backslash.)
Code:
 <img src="image.gif" class="bottom-right" alt="image" />
Since you are using an XHTML 1.0 Trans doctype, you might want to create stylesheet.css, and put all of your CSS in that file, then link it in your header. And don't forget that you need to close your linebreaks: <br />

Last edited by Riane : 06-29-2007 at 11:28 AM.
Riane is offline
Reply With Quote
View Public Profile Visit Riane's homepage!
 
Old 06-29-2007, 03:16 PM Re: How to float image to bottom right?
LadynRed's Avatar
Super Moderator

Posts: 6,559
Location: Tennessee
In order to make FF "wrap" the floated element, you must CLEAR the float. You can read how that's done here: http://css-discuss.incutio.com/?page=ClearingSpace
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to float image to bottom right?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13494 seconds with 12 queries