473,396 Members | 2,011 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,396 software developers and data experts.

Floating div drops with long text in Firefox (CSS Issue)

rblaettler
I have two div's with a float:left attribute that I've put into a list. They should align horizontally, which they do as long as the text in them does not need to be wrapped. As soon as the area for the float gets too small, IE wraps the text, but FF drops the div below the other before it starts to wrap the text. This is not exactly what I want. I could use absolute positioning, but that leads to other issues and is not really what I wanna do anyway. The simplified example page is below and core code too:

http://remy.supertext.ch/uploads/floatproblem.html

You can see the effect if you narrow the Window in FF and in IE. It works in IE7 as expected.

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.  
  3. ul.GenericList
  4. {
  5.     list-style: none;
  6.     width: 100%;
  7. }
  8.  
  9. ul.GenericList li
  10. {
  11.     clear:both;
  12.     width: 100%;
  13. }
  14.  
  15.  
  16. ul.GenericList div
  17. {
  18.     float: left;
  19. }
  20.  
  21. </style>
  22.  
  23. <ul class="GenericList">
  24.     <li style="">
  25.             <div >
  26.                 <div style="background-color:Yellow;">Test</div>
  27.                 <div style="background-color:Aqua;">
  28.                     <b>Short Text</b><br />
  29.                 </div>
  30.             </div>
  31.     </li>
  32.     <li style="">
  33.             <div >
  34.                 <div style="background-color:Yellow;">Test</div>
  35.                 <div style="background-color:Aqua;">
  36.                     <b>Short Text</b><br />
  37.                 </div>
  38.             </div>
  39.     </li>
  40.     <li style="">
  41.             <div >
  42.                 <div style="background-color:Yellow;">Test</div>
  43.                 <div style="background-color:Aqua;">
  44.                     <b>Long Text and very long Text. Long Text and very long Text. Long Text and very long Text.</b><br />
  45.                 </div>
  46.             </div>
  47.     </li>
  48. </ul>
Any ideas?
Oct 15 '08 #1
8 5571
drhowarddrfine
7,435 Expert 4TB
As usual, IE is wrong. Never use IE as a reference for how things should work.

You've set the <li> as 100% width. When you narrow it down, it has to make things fit inside so it drops the text to the next line. What IE is doing is a bug in IE.
Oct 15 '08 #2
David Laakso
397 Expert 256MB
http://remy.supertext.ch/uploads/floatproblem.html
You can see the effect if you narrow the Window in FF and in IE. It works in IE7 as expected.
The IEs get it wrong.Code to compliant browsers. Fix the IEs.

The construct of the division needs to be changed [1]. The list is not needed and is extraneous and unnecessary markup-- that is, unless of course, I have completely misunderstood what you're trying to accomplish.
[1] Plese see amended division construct
PS
Given the uri is provided, as yours was, it is not necessary to post the code to the forum-- anyone can open the document to view the markup and css. More important, validate your markup before posting a question about (x)html/css. Thanks.
Oct 15 '08 #3
Sorry about the validation. I just quickly put together a simplyfied example. I posted the code so that "future generation" can still get the idea. It's always unfortunate if you find the solution to a problem, but the link is not working anymore.

Anyway, what I'm trying to achive is some flexible table like structure. The app also has to work on the iPhone afterwards and most iPhone navigation examples work with lists. So I based my design on a list too.

Since it's only text and not one long character, I would have hoped that it would word wrap the text before it drops the div down.
What can I do to achive that without fixed width or absolute positioning?
Oct 15 '08 #4
drhowarddrfine
7,435 Expert 4TB
It will word wrap. Just not the way you have it. Don't have time to show an example right now.
Oct 15 '08 #5
An example would help :-)
Or a hint on what I'm doing wrong?
Oct 16 '08 #6
David Laakso
397 Expert 256MB
Since it's only text and not one long character, I would have hoped that it would word wrap the text before it drops the div down.
What can I do to achive that without fixed width or absolute positioning?
Please forgive me, but this entire thread is about as clear as mud. As may be this suggestion: use a "table like" (no width specified) definition list?
Aside: My piece of garbage (personal opinion) iPhone has no difficulty rendering what I suggested a couple of days ago, or with the above suggestion for the use of a "table like" definition list where no width is specified.
Oct 18 '08 #7
Thanks for the hint about the definition list. I've created an example with that approach, which works fine in FF, but has some issues with IE. Sometimes it does it side by side and sometimes it drops all rows. Depends on the width of the window.

Is there really no solution with my initial list approach? We do have the iPhone as the standard phone in my company, so it's not really my decision.
Oct 22 '08 #8
David Laakso
397 Expert 256MB
Is there really no solution with my initial list approach? We do have the iPhone as the standard phone in my company, so it's not really my decision.
Nothing is impossible: depending whether or not "your company" can live with the consequences-- in this case, widths are needed, a lot of code is necessary, and hacks from here to Havana are required to get the right column to come even close to holding in the IEs. This [1] is a modification, I took the liberty to make, on a test case example somewhat similar to yours by Alex Robinson . Further modification is on you. Incidentally, Alex makes it clear on his site that he does not provide answers or solutions to problems.
[1] float drop in Internet Explorer with long text
Oct 22 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JHR | last post by:
Hey all, I'm trying to make a sidebar box float to the right of various items, and for those items to wrap if a user shrinks his browser window. Instead, in every browser I've tried except for...
5
by: tomasio | last post by:
Dear Group, The Site under the following link (http://tomasio.laudatio.com/temp/schiepek/index.html) displays as I want it to in IE 6 (under Win XP) but does not render correctly in Firefox...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
1
by: bryanrite | last post by:
I have two floating divs within a 100% width container div. In IE when you resize the window to the point where the text should wrap, it wraps and extends the height of the container div. In...
1
by: Lee K. Seitz | last post by:
I created this page (http://home.hiwaay.net/~lkseitz/comics/newu/publishing.shtml; CSS at http://home.hiwaay.net/~lkseitz/comics/newu/newu.css) while looking at it in Firefox 1.05 (Win 9x) and it...
2
by: deja | last post by:
I'm trying to get to grips with CSS and finding it a bit of a nghtmare with cross-browser problems. I am only testing IE6 and Firefox 1.5 so I've hardly touched the surface of what problems I could...
0
by: ltlpeepl | last post by:
I'm having the issue where I have floating spans that overlap in IE6 when wrapping should occur. If you make the browser window small enough so that wrapping will occur, they will overlap, making...
4
by: Ivor Somerset | last post by:
Dear CSS community, The code below shows my problem. I have a containing DIV box into which I place floating boxes. As the background-color shows, the size of the containing box is not extended...
5
by: jemcgui | last post by:
I've been building a site that has a quirk in it. It will display just as intended in IE but not firefox. The left "nav" div which is floating left will be forced down to the bottom of the page. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.