473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problem aligning with float and clear

Hello.

I want to display a number of individual blocks of text. Each block
has an associated image, which should be displayed on the right and
aligned with the top of its block of text, i.e.
(use a fixed-width font to view this!)

Some short text. +-------+
| |
+-------+

This one has some +-------+
longer text which | |
will wrap around +-------+
the image on the right.

I'm using this markup for each of the blocks:

<div style="width: 256px; height: 192px; margin-left: 20px; float:
right; clear: right; background-image: url('image.png')">
</div>
<div style="vertical-align: top">
<p>Text to appear on the left</p>
</div>

(The 'background-image' bit is used to achieve a single-image rollover
effect: the 256 x 192 region clips the bottom half of the 256 x 384
image, and onMouseOver shifts the other half into view. Anyway, that's
not the problem.)

The page renders as intended in MSIE, but under Firefox and Safari
(and perhaps other more standards-compliant browsers) the text shifts
up into previous blocks, i.e. "float: right; clear: right" does not
ensure that each subsequent block is clear of the previous one and
aligned with the next corresponding image.

What am I doing wrong here, and how can I correct it?

P.
Oct 14 '05 #1
0 1371

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Florian Brucker | last post by:
Hi! I've got a problem with float & clear. Take this example code: <div style=" width:100px; height:100px; background-color:#FF0000; float:left; margin:10px;"></div> <span...
10
by: NoSpan | last post by:
I have this page that has layout like the following: (no frameset) ---------------------------------------- | header | |--------------------------------------| | ...
3
by: Listerofsmeg | last post by:
Hi all, Is this possible? I have a simple DIV with some text and an image inside. I want the text to wrap around the image, but I want the bottom of the image to sit on the bottom of the DIV. ...
5
by: Chris Beall | last post by:
See http://pages.prodigy.net/chris_beall/BeallSprings/WC.Deed%20GG.116-17.html using the CSS at http://pages.prodigy.net/chris_beall/BeallSprings/BSstyle.css The page is a transcript of a...
5
by: Tony | last post by:
I seem to be missing something in my understanding. If I leave off absolute positioning, shouldn't nested DIV/SPAN be displayed inside the parent, and ones outside that display separately? Here...
1
by: books1999 | last post by:
Hi there, I have a problem with this css/div and i cannot work it out. I would like either container to be able to push the background box to grow but in Firefox it overflows. Can someone find a...
19
by: rmr531 | last post by:
First of all I am very new to c++ so please bear with me. I am trying to create a program that keeps an inventory of items. I am trying to use a struct to store a product name, purchase price,...
1
by: donpro | last post by:
Hi, I'm creating a template paging sing pure CSS and all looks good except the footer which I am having problems with. 1) When I space out each of the FOUR DIVS at 25%, it wraps in IE. I...
1
by: innivive | last post by:
I am having a problem with having margins display correctly in IE7, Firefox and Safari. I am not sure if it is the "double margin error" or something else. Any help would be appreciated. The file...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.