473,385 Members | 1,461 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,385 software developers and data experts.

simple BOX MODEL Layout

realin
254 100+
hello guys,

I am just unable to make a simple 2 Box model layout layout work perfect on the browsers IE and ffx. My resulting webpage responds variably on either of them..

The problem is that but the IE shows a margin of 20px and ffx shows a margin of 10px from right..

the main box is container containing another box right. and the code for the same is here
[html]
<!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>
<style type="text/css" >
.container{
background:url(./ask/img/bg_grad.gif);
background-repeat:repeat-y;
border:1px solid #e0e0e0;
padding:0px;
margin:0px 100px 0px 100px;
width:825px;
border:1px solid red;
height:1000px;
}

.right{

float:right;
background:#ffffff url('./ask/img/content.gif') no-repeat top right;
border-left:2px solid #e0e0e0;
width:190px;
border:1px solid red;
margin:0px 10px 10px 0px;
padding:30px 10px 10px 10px;
height:2000px;
}

</style>
</head>

<body>
<div class='container'>
<div class='right'></div>

</div>

</body></html>[/html]

I have given the heights here just to see the elements .. but in actual page i am using JS to make the heights equal..
Oct 16 '07 #1
1 1821
drhowarddrfine
7,435 Expert 4TB
As always, the problem again is IE.

One thing to always remember is that floated elements are removed from the normal flow. So any parent element that contains them will collapse to contain the next positioned element that is not floated or absolutely positioned. And that is what is happening with your .container div in Firefox, which is performing correctly.

IE, on the other hand, is showing one of its major bugs by expanding the containing element to contain those floats which, as I mentioned, is not supposed to happen.

To get modern browsers, like Firefox, Opera and Safari, to do what you want, you want to tell the containing div to expand to contain this content that is "overflowing" out of it. So, in your css for .content, add 'overflow:auto'.

Now, just a quick glance shows me there will be a scrollbar created but this may have to do with a height for something there or margins, but I don't have time to look right now.
Oct 16 '07 #2

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

Similar topics

13
by: Droolboy | last post by:
I'm trying to build a fairly small (max. 10 different pages) site using php, and it's becoming obvious that I need some kind of model view separation. Having done a few searches, I've come...
1
by: Dario de Judicibus | last post by:
I wish to create two simple layouts by using only HTML, CSS and the minimum JavaScript as possible. Layouts should be "elastic" (no fixed widths and heights) and cross-browser enabled. The first...
13
by: Stephen Poley | last post by:
Good advice is frequently given in c.i.w.a.* on page structure: matters such as separation of content from presentation, graceful degradation, non-dependence on Flash etc. For some while I've...
4
by: Geoff Hague | last post by:
I've decided I need to rebuild my website from scratch to work properly accross browsers (the previous version of the site worked fine in IE6, but was really wonky in other browsers). What I'm...
3
by: Robert Mark Bram | last post by:
Hi All! In the code below, I want to add a handler to a *row* (eventually so I can change the style of a row), but the event is being generated by the TD's it seems - in Opera and IE. Is there...
3
by: KevinD | last post by:
thank you for your helpful explanations. In my first note I forgot to mention that my simple flatfile is a text file with a newline character at the end thus I able to get an entire record . ...
50
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>...
3
by: Rangy | last post by:
Hi, I've decided to take the plunge and move from tables to a pure css layout. I still "think" in tables when I do my layouts and I was wondering the following: I have a simple, standard two...
10
by: sumsin | last post by:
The C++ Object Model book says that 'Nonstatic data members are allocated directly within each class object. Static data members are stored outside the individual class object. Static and...
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: 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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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: 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...

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.