•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 430,769 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,570 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1415 | Replies: 8
![]() |
•
•
Join Date: Apr 2006
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I am trying to have a right floating image in my content that needs to appear at 100px from the top of the content. My content should flow around the right image. I managed to do this as follows:
<div style="width:1px;height:100px;float:right;"> </div>
<table border="0" cellpadding="0" cellspacing="0" style="padding:15px 0px 10px 10px; clear:right;float:right;" width="337">
<tr><td>image here</td></tr></table>
The 1px div pushes the table down and allows the content to flow around the table. Ok, this works. Now comes the problem.
When I want to left align an image in my content, in FIREFOX, this image jumps down in the content and some content even covers the image. I figured this is because of the clear:right; in my right side table that is influencing my left side image. IE doesn't have this problem.
Any ideas on how to fix this problem?
Thanks!
Xavier
I am trying to have a right floating image in my content that needs to appear at 100px from the top of the content. My content should flow around the right image. I managed to do this as follows:
<div style="width:1px;height:100px;float:right;"> </div>
<table border="0" cellpadding="0" cellspacing="0" style="padding:15px 0px 10px 10px; clear:right;float:right;" width="337">
<tr><td>image here</td></tr></table>
The 1px div pushes the table down and allows the content to flow around the table. Ok, this works. Now comes the problem.
When I want to left align an image in my content, in FIREFOX, this image jumps down in the content and some content even covers the image. I figured this is because of the clear:right; in my right side table that is influencing my left side image. IE doesn't have this problem.
Any ideas on how to fix this problem?
Thanks!
Xavier
firefox and ie display positions in different spots, it irritates me. try this i think it will work
add this style to your body, which takes out the white space around your page, which i think is different between the browsers which is why they display different
<body style="padding:0px ; margin:0px; "></body>
add this style to your body, which takes out the white space around your page, which i think is different between the browsers which is why they display different
<body style="padding:0px ; margin:0px; "></body>
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Applying float to an element will make other elements below that element float "left/right" of that element.
For example...
Should present something like this...
||||||||| Duis molestie ligula nec nunc. Vivamus
||||||||| egestas enim ac dolor. Maecenas et
||||||||| purus. Aenean vel mi ultrices purus
varius sagittis.
I'm not sure if that helps you at all, and if you already knew what I described I didn't mean to patronise you. Perhaps you could post some images of your situation?
For example...
CSS
-----
#photo {float: left;}
-----
XHTML
-----
<img id="photo" scr"image.jpeg" />
<p>Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis.</p>
-----Should present something like this...
||||||||| Duis molestie ligula nec nunc. Vivamus
||||||||| egestas enim ac dolor. Maecenas et
||||||||| purus. Aenean vel mi ultrices purus
varius sagittis.
I'm not sure if that helps you at all, and if you already knew what I described I didn't mean to patronise you. Perhaps you could post some images of your situation?
•
•
Join Date: Apr 2006
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks for the replies, here is the code that illustrates my problem:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
#container {width:500px;font-family:arial;font-size:11px;}
.rightimage {float:right;clear:right;margin:20px 0 20px 20px;border:1px solid #ccc;}
.leftimage {float:left;margin:0 20px 20px 0;border:1px solid #ccc;}
</style>
</head>
<body>
<div id="container">
<div style="width:1px;height:80px;float:right;"> </div>
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="rightimage" alt="" border="0" />
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="leftimage" alt="" border="0" />Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis.
</div>
</body>
</html>
Looks fine in IE, the left image should be on top left aligned. In Firefox, this images drops down... The right image has to be right aligned at a certain height. Client is king.
Thanks for your help.
X.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
#container {width:500px;font-family:arial;font-size:11px;}
.rightimage {float:right;clear:right;margin:20px 0 20px 20px;border:1px solid #ccc;}
.leftimage {float:left;margin:0 20px 20px 0;border:1px solid #ccc;}
</style>
</head>
<body>
<div id="container">
<div style="width:1px;height:80px;float:right;"> </div>
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="rightimage" alt="" border="0" />
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="leftimage" alt="" border="0" />Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis.
</div>
</body>
</html>
Looks fine in IE, the left image should be on top left aligned. In Firefox, this images drops down... The right image has to be right aligned at a certain height. Client is king.
Thanks for your help.
X.
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Ah ok I think I see what you mean now. I'm not near a windows machine to make sure though. Is it that you would like the image to come 100px down from the top of the text? If so, and you use the margin attribute to do this ie. margin: 100px; from what I can remember margins won't appear around images in IE. I can remember for sure though.
From this I presume that your using the div element to create that desired 100px for your right image. In which case is probably not the best method. If what I'm talking about is correct you could try something like the following method...
This might not be the most efficient solution to your problem, but it should give you the desired look you want across all platforms.
From this I presume that your using the div element to create that desired 100px for your right image. In which case is probably not the best method. If what I'm talking about is correct you could try something like the following method...
CSS
-----
.image-wrap {
margin-top: 80px;
float: right;
}
.image-left {
float: left;
padding: 20px;
}
.image-right {
padding: 20px;
}
-----
XHTML
-----
<img class="image-left" src="left-image.jpeg" />
<span class="image-wrap"><img class="image-right" src="right-image.jpeg" /></span>
<p>Your text here</p>
-----This might not be the most efficient solution to your problem, but it should give you the desired look you want across all platforms.
•
•
Join Date: Apr 2006
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
Ok now, it makes sense. Hmmm. I'm not sure if it's possible to do that. I'm guessing it would require something a little advanced to create that effect. Not sure if this link helps at all... http://www.bigbaer.com/css_tutorials....text.wrap.htm
The other suggestion would be just to move the left image above the div and right img.
For example...
It's not very clean markup, however it should create the illusion on the image being part way down the text.
The other suggestion would be just to move the left image above the div and right img.
For example...
<img class="image-left" src="left-image.jpeg" /> <div style="width:1px;height:80px;float:right;"> </div> <img class="image-right" src="right-image.jpeg" />
It's not very clean markup, however it should create the illusion on the image being part way down the text.
i swaped the 2 images around so they are in logical order(left before right) and it seemed to fix the problem
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
#container {width:500px;font-family:arial;font-size:11px;}
.rightimage {float:right;clear:right;margin:20px 0 20px 20px;border:1px solid #ccc;}
.leftimage {float:left;margin:0 20px 20px 0;border:1px solid #ccc;}
</style>
</head>
<body>
<div id="container">
<div style="width:1px;height:80px;float:right;"> </div>
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="leftimage" alt="" border="0" />
<img src="http://www.daniweb.com/techtalkforums/dani-images/misc/dani/logo.gif" class="rightimage" alt="" border="0" />
Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis. Duis molestie ligula nec nunc. Vivamus egestas enim ac dolor. Maecenas et purus. Aenean vel mi ultrices purus varius sagittis.
</div>
</body>
</html>![]() |
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Css floating problem (HTML and CSS)
Other Threads in the HTML and CSS Forum
- Previous Thread: Cell as LINK
- Next Thread: need help


Linear Mode