Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
CSS positioniing in IE
Old 05-05-2005, 08:49 AM CSS positioniing in IE
Novice Talker

Posts: 8
Trades: 0
Hello all,

I am building a web site and have started using CSS to position my elements in the browser window. It works fine in all browsers I have tested it with, except Explorer on Windows ... duh!

Here is what I want to do: I have a sidebar with a logo and navigation menu, which has a fixed size. I want the other elements to fill the remaining space on the right of the menu. To do this, I have given the elements on the right these settings:

position: absolute;
top: 0px;
left: 165px;
right: 5px;

In most browsers, this makes the element span the entire browser window except for the menu space on the left. Some of the elements are centered, so if there is not enough content to fill the available space, the image or text appears in the center of the space. Except in IE, where all my content is huddled on the left size.

Can anybody advise me? Am I doing something wrong, or is this a bug in IE? How can I set it right?

Here is a link to a page that shows my problem (sorry, the site is in French):
http://profils.reliefs.free.fr/spip/...id_document=66

Thanks in advance for any help.

Florence
f.artur is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-05-2005, 09:57 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
dont you just love bill and his idea of what standards are for.

Instead of positioning things absolute I tend to float everything to the left.

heres an example

Code:
<html>
<head>
<style type="text/css">
#page{float:left;
      width:90%;
      height:100%;
      background:lightgrey;
      border:1px solid black;
}

#top{float:left;
     margin-top:2%;
     margin-left:1%;
     width:95%; 
     height:10%;
     background:white;
     border:1px solid black;
}

#menu{float:left;
      margin-left:1%;
      margin-top:1%;
      width:13%;
      height:80%;
      background:white;
      border:1px solid black;
}

#content{float:left;
         margin-left:1%;
         margin-top:10px;
         width:81%;
         height:80%;
         background:white;
         border:1px solid black;
}
#footer{float:left;
        margin-top:1%;
        margin-left:1%;
        height:4%;
        width:95%;
        background:white;
        border:1px solid black;
}
</style>
</head>
<body>
<div id="page">
   <div id="top">header</div>

   <div id="menu">
    menu
   </div>

   <div id="content">content</div>
   <div id="footer">footer</div>
</div>
</body>
</html>
As you can see everything is floating to the left. This removes the need for absolute positioning and all the headaches that come with things been absolute.

Load up the html you will see it appears both the same in NN or IE infact I will be so bold as to say that any broswer will disaply it as it should look (providing they are css compliant).

The bueaty of float is that you need not think too much about about positioning as float:left will always stack your divs to the left.

Also take note of the use of % instead of px based positioning. 1px in firefox can resemble 10 in IE (ok exageration) but you all get my point.

Of course to make thing really easy on us all we should get Bill to code his browser to everyone elses standard (but yea bill knows best).

Hope I have helped some.

P.S.

Of course when you come to adding content you will need to drop the height attributes or change them to auto. This will keep the fluid feel of the site with everything floating inside the page tag.

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf

Last edited by ibbo; 05-05-2005 at 10:22 AM..
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 05-05-2005, 10:13 AM
Novice Talker

Posts: 8
Trades: 0
Thank you Ibbo. This sounds interesting, I'll try it right away.
f.artur is offline
Reply With Quote
View Public Profile
 
Old 05-05-2005, 10:35 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
I also recall that you can infact leave the height attribute in place for IE ignores it. This means that heigh:80% in IE will be ignored if the divs content stretches it behond 80% IE if the content goes behond 80% then the div will automagically extend itself to fit the content. Firefox could do with a lesson here..

A plus for IE there then as NN will let you say min-height:800px (no % in NN for this).

Ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 05-05-2005, 01:46 PM
Super Moderator

Posts: 1,576
Location: Kokkola, Finland
Trades: 1
well according to the spec firefox gets it right and the overflow property should be used to dictate what happens should the content exceed the 80% height
http://www.w3.org/TR/CSS21/visudet.html#propdef-height and
http://www.w3.org/TR/CSS21/visufx.html#overflow
so seems that again it's IE that could do with the lesson
davemies is online now
Reply With Quote
View Public Profile Visit davemies's homepage!
 
Old 05-08-2005, 03:29 PM
Novice Talker

Posts: 8
Trades: 0
OK, I give up! I almost managed to use the "float" settings, but in the end IE5 for Mac killed it. I'm not sure how many people still use that, but I know at least two who do - and my client is one of them.

So I'm going back to absolute positioning and fixing the position and width of all elements. Which means, of course, setting it up for a 800x600 monitor. I hate it but that seems to be the only option left if I want people to actually see the website.

I think it looks OK now, though a few alignments may look a bit awkward. If you have the time, please take a look and let me know of any problem:

http://profils.reliefs.free.fr/

Thanks in advance

Florence
f.artur is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS positioniing in IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17275 seconds with 12 queries