This is a discussion on "Positioning problem - help please" within the Web Page Design section. This forum, and the thread "Positioning problem - help please are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Positioning problem - help please
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Positioning problem - help please
A few people using IE have reported that some of the pages of my site http://sourgumdrop.org.uk (including index.html) are not displayed correctly. The main text should appear to the right of the menu (not below as it does for them). Naturally it works on my system so I cannot experiment.
How can I cure this for all browsers? Thanks in advance. |
|
|
|
#2
|
|||
|
|||
|
Re: Positioning problem - help please
The problem relates to the way the sums work out. On your two main panels, you have a combination of percentage width plus fixed size border, margin and padding.
With the viewing window of the browser at certain widths, adding up the various elements gives you a total width greater than the viewing window and therefore the main panel cannot float up into position. The problem is also compounded by the box model problem in IE. If you experiment, I think you will find the layout will break in IE, FF and Opera once the viewing window gets below a certain point. |
|
#3
|
|||
|
|||
|
Re: Positioning problem - help please
ukgeoff has identified the cause of my problem and I think we've partially solved it, BUT I am still unsure!
I give this lengthy description in the hope that it may help others who are struggling like me, and because I still do not understand the behavior of IE. Please read on. I have two panels: The display went wrong for some users when I had: div.options { float: left; width: 20%; border: 1px solid #000; margin-left: 2px; ... } div.main_info { float: right; width: 78%; border: 1px solid #000; margin-left: 2px; padding-left: 5px; padding-right: 5px; ... } My original reasoning was as follows: I knew it was not a good idea to mix absolute and relative sizes but wrongly assumed that these few fixed pixels would not be a problem. I thought that 4 * border + margin-left + margin-left + padding-left + padding-right = 4 + 2 + 2 + 5 + 5 = 18px would always be < 100% - (78% + 20%) i.e. 18px < 2% This means that 9px < 1% and hence 900px < 100% and so if the browser was set >900px the pages should display as I wanted. This logic fitted with FF and Konqueror experiments where I varied the px sizes of the borders, margins, padding and the panel percentages. And on my machines the pages displayed correctly on IE, but others reported problems. I do not know their screen widths. UKGEOFF pointed out these few pixels combined with percentages did matter so I switched to percentages as far as possible. I could not specify border as a % so left it at 1px and now I have: div.options { float: left; width: 20%; border-right: 1px solid #000; margin-left: 1%; ... } div.main_info { float: right; width: 74%; margin-left: 1%; padding-left: 1%; padding-right: 1%; ... } 1 * border + margin-left + margin-left + padding-left + padding-right = 1px + 1% + 1% + 1% + 1% + 20% + 74% = 1px + 98% so 1px must be < 2% and hence 50px < 100% This logic works fine for FF and Konqueror: neither of which will let me shrink the browser width to 50px but they go on displaying the pages "correctly" right down to their minimum. Of course IE is different: it flips the righthand panel below the left panel at about 720px. WHY? Is my logic wrong, or my basic understanding of css wrong, or both? Can anybody explain or point me at a suitable reference on the web, please? Thanks in advance. |
|
#4
|
|||
|
|||
|
Re: Positioning problem - help please
Change the code blocks shown below - EXACTLY.
See how you go with that. BTW: If you reduce the window size, you will see that there is a problem with the header banner but I'll let you have a go at that yourself. Last edited by ukgeoff; Apr 21st, 2006 at 17:14. |
|
#5
|
||||
|
||||
|
Re: Positioning problem - help please
Quote:
I can live without max-width if I can make things fit the first time through. But I'm not going to spend hours creating hacks if minor players like Netscape can't bother to comply. |
|
#6
|
|||
|
|||
|
Re: Positioning problem - help please
Quote:
width + padding + border + margin IE's version is width(includes any padding) + border + margin hence the problem. |
|
#7
|
|||
|
|||
|
Re: Positioning problem - help please
Well I applied ukgeoff's suggestions exactly and I am grateful for his help, but there were side effects I did not like so I have abandoned my original plan of using percentages and switched to fixed px values for all panels, borders, margins and padding.
Although, as my experiments confirm FF and IE do their sums differently (see discussion between ukgeoff and masonbarge), with some fiddling around I've found a combination of sizes that appear to satisfy all the browsers I have access to. Do they work on yours??? As ever, I'd be grateful for any comments on the current attempt. |
|
#8
|
|||
|
|||
|
Re: Positioning problem - help please
I would appreciate knowing what these side effects were.
Might be something I could make some helpful comment on. |
|
#9
|
||||
|
||||
|
Re: Positioning problem - help please
The biggest help from IE is that it sets box width in accordance with w3c: total size of a box = width + margins/borders/padding. Firefox includes these in the width size, which actually may make more sense, but it's counter-standard. IE is better at rendering accurate font sizes, too, but not as good at rendering colors accurately.
From W3c Rule 4 Quote:
They both have PLENTY of nonsense built in. I use FF for browsing because I like the way it works on the user end, although Opera has a couple of interesting innovations. Anyway, on the develepor side, you have to blame Mozilla for those horrible 3px differences in IE and FF. |
![]() |
| Tags |
| positioning, problem, help |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] DIV Positioning Problem | winnard2007 | Web Page Design | 6 | Jan 23rd, 2008 09:22 |
| relative Positioning Problem | Dunce | Web Page Design | 6 | Jun 8th, 2007 10:54 |
| Problem with image positioning | Marc | Web Page Design | 1 | May 31st, 2007 18:17 |
| positioning problem PLEASE help | geoffb | Web Page Design | 4 | Sep 16th, 2006 06:39 |
| CSS Positioning Problem - Mac IE 5.2 | clearchannel | Web Page Design | 0 | Mar 31st, 2006 10:03 |