473,491 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Long text moves a DIV in FF

25 New Member
Hi,
I'm trying to set up a table-less layout using CSS. I have a simple two-column layout that works great in IE, but has a bug in FF.

In the code below, when the contents of the content_area DIV are a few words, the two columns are fine in both IE and FF. However, if the 2nd column contains enough text to run onto the next line, then the column acts like a row in FF. It moves below the 1st column.

I'm sure it's a simple thing. Any idea what needs to be done?

Thanks.

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <title>2 col</title>
  6. <style type="text/css">
  7. <!--
  8.  
  9. body{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;}
  10.  
  11. .page_container{margin-left:0;margin-right:auto;width:800px; padding-left:0; margin-top:0; padding-top:0; background-color:#FFFFFF; overflow:auto}
  12. .nav_area{display:inline;float:left;margin-left:10px;margin-right:10px;  max-width:110px; min-width:110px; border:dotted}
  13. .content_area{display:inline;float:left;margin-left:10px;margin-right:10px; background-color:#99FFFF; min-width:300px; white-space:nowrap}
  14.  
  15.  
  16. body {
  17.     background: #123;
  18.     color: #333;
  19. }
  20.  
  21. -->
  22. </style>
  23. </head>
  24. <body>
  25. <div class="page_container">    
  26.     <div class="nav_area">
  27.     blah blah
  28.     </div>
  29.     <!-- end .nav_area -->
  30.     <div class="content_area">
  31.         <p>sss ssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss sssss</p>
  32.  
  33.  
  34.     </div>
  35.     <!-- end .content_area -->
  36.     <div class="clear"></div>
  37.  
  38. </div>
  39. <!-- end .page_container -->
  40. </body>
  41. </html>
  42.  
Jun 8 '10 #1
9 2295
drhowarddrfine
7,435 Recognized Expert Expert
In your CSS you are saying 'white-space:nowrap' and FF appropriately does what you told it to do. Never, ever trust IE to do anything right.
Jun 8 '10 #2
svendok
25 New Member
Thanks. Actually, I added that at the last minute as an experiment and meant to delete it before posting my message. The 2nd div jumps down in FF whether it's there or not.

I'm sure this is IE's fault, but I don't know what property I should be looking at to control this behavior. I imagine there's no "jump-on-wordwrap:" setting! :)
Jun 8 '10 #3
JKing
1,206 Recognized Expert Top Contributor
I suggest using fixed widths on your divs to control the layout. Especially the nav div where you have declared min and max width to be 110px.

If you still would like to maintain the min-width property of your content div then you can wrap it in another div that has a fixed width.
Jun 9 '10 #4
svendok
25 New Member
@JKing
Thanks, JK. I'll try that. The width should include the padding-left & padding-right, right?

Like your avatar. What's it from?

Thanks.
Jun 9 '10 #5
JKing
1,206 Recognized Expert Top Contributor
@svendok
The width should not include padding.
Here is a good reference for the box model Box Model

The avatar was just a random gif I found years ago. :)
Jun 9 '10 #6
svendok
25 New Member
@JKing
Looks like I fixed it. Doesn't seem like it was the width settings that did the trick but simply experimenting with the position: property.


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <title>2 col</title>
  6. <style type="text/css">
  7. <!--
  8.  
  9. body{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background: #123;color: #333;padding-top:0px;}
  10.  
  11. .page_container{margin-left:0;margin-right:auto;width:800px; padding-left:0; margin-top:0; padding-top:0; background-color:#ffffff; overflow:auto;  min-height:500px; padding-top:0px;}
  12. .logo_area{margin-left:0;margin-right:auto;width:800px; padding-left:0; margin-top:0; padding-top:0; background-color:#ffffff; overflow:auto;  padding-top:0px;}
  13. .nav_area{display:inline;float:left;margin-left:10px;margin-right:10px;  max-width:110px; min-width:110px; width:130px; border:none; border-bottom-style:double; border-color:#0066FF; overflow:auto; position:relative}
  14. .content_area{display:inline;float:left;;margin-right:10px; width:650px; background-color:#FFFFFF; white-space:normal; border:groove; border-color:#0066FF; position: absolute; padding-top:0px; }
  15.  
  16.  
  17.  
  18. -->
  19. </style>
  20. </head>
  21. <body>
  22. <div class="page_container">    
  23. <h1 align="center"><img src="http://bytes.com/topic/images/banner.gif" width="581" height="130"> </h1>
  24.  
  25.     <div class="nav_area">
  26.     <!--#include file="../menu.js"-->
  27.     &nbsp;
  28.     </div>
  29.     <!-- end .nav_area -->
  30.     <div class="content_area
  31.         <p>sss ssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss ssssss sssss</p>
  32.  
  33.  
  34.     </div>
  35.     <!-- end .content_area -->
  36.     <div class="clear"></div>
  37.  
  38. </div>
  39. <!-- end .page_container -->
  40. </body>
  41. </html>
  42.  
Jun 9 '10 #7
svendok
25 New Member
@JKing
Okay, just making sure this wasn't some monster I should recognize. Never have time to play the games anymore. [Sigh]
Jun 9 '10 #8
drhowarddrfine
7,435 Recognized Expert Expert
Be careful of using old, deprecated markup. "align" was deprecated 10 years ago in HTML 4.01 and does not exist in HTML5. It works because browsers must maintain backwards compatibility but you never know when it will go away.

Don't use clearing divs or I will have to start mentally abusing you. They should not be needed just as "spacer gifs" were not needed once CSS came around.
Jun 9 '10 #9
svendok
25 New Member
@drhowarddrfine
Thanks for the reminder, Dr. H.

I do realize "<h1 align=center>" is bad form--that was inserted by Dreamweaver--but being new to CSS I don't know why the clearing DIV's are bad (or even why they're there in the first place to be honest). I got the basic code from a CSS generator site.

Guess I need to educate myself on this.


Thanks.
Jun 10 '10 #10

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

Similar topics

3
7172
by: Adam | last post by:
I have an ASP page that will take form info that a user has entered, then save it into SQL server, and retrive and display the info on another page. My problem is with long text data (10,000 bytes...
1
2145
by: Paul Thakur | last post by:
I am writing vbscript code in an .asp page. I need to display field values from a sql table consisting of several fields, one of them is of type "Long Text". This field contains XML data. I like to...
2
6476
by: Radu | last post by:
Hi. I got a "|" delimited file, and one of its columns (the last one) is MANY chars long. If I use my try to manually import the file, the text in the last column is cut off at char 255, as it...
0
1410
by: RON | last post by:
I have to read a long text field (it's a PDF) from SQL Server in a VB.NET (2003) app. Here's the code I have: Sub GetPDF(byval Path as string) 'objConnection created elsewhere; not the problem...
0
1119
by: RON | last post by:
have to read a long text field (it's a PDF stored in a column) from SQL Server in a VB.NET (2003) app. Here's the code I have: Sub GetPDF(byval Path as string) 'objConnection created elsewhere;...
2
5652
by: sadf | last post by:
I need to use MySql to store really large amounts of data . but when i try to store ,text file in long text field with LOAD_FILE command, the error i got was like : "Data too long for...
6
3727
by: Victor | last post by:
Hi all i have a css question about how to wrap a long text by using css. for example I have a very long text like "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" there...
1
2938
by: namhay | last post by:
I have a long text store in MySQL about 10 lines for detail page. But in my home page i want to show Short text only 2 lines by using PHP query and let them click for detail. How can i cut this long...
3
5073
by: stevedude | last post by:
A CSS newbie here: I've been learning CSS as I go along developing a web page. I am trying to make a horizontal menu link for a footer. On 'hover', I want the linked text to have a 'bold' font for...
8
5576
rblaettler
by: rblaettler | last post by:
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...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7190
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.