IE, FF one of them can't calculate the height

Discussion in 'CSS' started by motofoto, Dec 13, 2008.

  1. #1
    Hi


    #TheDIV {
    position:absolute;
    margin:0px;
    padding:0px;
    background-color: yellow;
    top:161px;
    left:0px;
    bottom:59px;
    right:0px;
    width:100%;
    }

    If you write CSS like this and open the HTML in the FF, FF will calculate the height for you. IE assume height is 0 unless you explicitly specify the height.

    height:100%; did not repect the bottom nor magin-bottom

    how can I fix this?
     
    motofoto, Dec 13, 2008 IP
  2. Ludus

    Ludus Active Member

    Messages:
    105
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    95
    #2
    Try to define margins like:

    margin: 161px 0 59px 0;
    Code (markup):
    without position.
     
    Ludus, Dec 13, 2008 IP
  3. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #3
    Of course, as always, FF is right and IE is wrong. Never, ever trust IE to do anything right. Absolutely positioned items will collapse with no content. If you specify 100% height, then 100% of what? It's 100% of its parent. So does the parent of this div have a height specified?

    Which version of IE? IE6 treats height as 'min-height' and min-height doesn't work at all.
     
    drhowarddrfine, Dec 13, 2008 IP
  4. motofoto

    motofoto Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi

    if mircrosoft is that big, why they are doing everything bugy??!!

    yes it is IE 7, and it gives me hardtimes, no matter what is right and what is wrong, it must work on both!!

    the parent is the browser window

    margin did not work as expected.

    Is there any way beside using javascript to have the div I need?

    Thanks
     
    motofoto, Dec 13, 2008 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    Because IE became the most populus browser BEFORE web developers gave a rats ass about anything the W3C did for 'standards' - and when IE6 was released it in fact WAS the most standards compliant browser to date.

    For all the talk and obsession with it, standards compliance is a relatively NEW concept in web design since standards compliant code was undeployable until very recently. (three to five years now)

    Odd that 7 is your problem, it's usually fairly well behaved, though as a rule absolute positioning of an element that's height relevant is generally made of /FAIL/ in any browser.

    You've not shown us enough code for that to actually be answered, as it relates not just to the "theDIV" element, but any elements it would interact with.

    It looks like you are trying for 100% fixed height - something that in web design is most of the time instantly made of /FAIL/... which is why you rarely see websites do it, and the ones that do generally suck and break cross browser, break when the system metric changes, etc, etc. What you probably SHOULD be designing for is called 100% min-height, in which case absolute positioning is REALLY made of /FAIL/
     
    deathshadow, Dec 13, 2008 IP
  6. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #6
    Uh, the W3C and the standards were around before IE, and if you use html or css or most technologies on the web, you are following web standards from the W3C. btw, Microsoft is a member of the W3C, too, along with virtually every well known software company in the world.
    That's the most ridiculous statement I've ever heard. HTML was published in 1989. The W3C was formed in 1994. IE1.0 didn't come out till 1995. Firefox has been out for 4 years and Opera and Safari before that.
    IE7 is the worst current browser on the planet.
    Only in IE. Modern web browsers have no such issues.
    min-height only works properly in modern browsers so that leaves IE out of that idea. (It works, somewhat, in IE7 but fails miserably in many situations.)
     
    drhowarddrfine, Dec 14, 2008 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Oops, wrong thread.
     
    deathshadow, Dec 14, 2008 IP
  8. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #8
    ... and neither Microsoft OR Netscape gave a rats ass about anything the W3C said about standards at the peak of the browers wars! Site developers were pushing non-standard technologies like crazy back then - REMEMBER the whole 'best viewed in IE' or 'best viewed in Netscape' banner nonsense?

    So how's that marquee tag coming along? Layers? ActiveX? Remember making FUN of netscape 4.x for being less standards complaint than IE5.x? The hordes of non-W3C tags BOTH Netscape and IE introduced? Apparantly not.

    Which is why their giving it little more than lip service is so funny.

    ...and prior to four to five years ago (much less today) how many websites even attempted to use valid HTML? How many developers even TALKED about standards compliance? The web is filled to the brim with non-standards code because nobody gave a rat's posterior about what the W3C had to say. YES, the W3C existed that long - and nobody gave a flying ****. Just six years ago the only question you got in corporate environments in terms of standards compliance was "Does it work in IE?" - or do you not remember that too?

    I keep hearing that - and apart from haslayout issues and it being a retard on LI behaviors It's still better than back-coding for IE6, and I have yet to have to target it specifically for anything I'm not already sending to IE and is unsafe to send to all browsers. Usually if you do have to target IE7, it's because you are trying to do something incorrectly in the first place!

    Let's be honest, four years ago we still had enough IE 5.x users we needed to worry about them, making the majority of CSS2 undeployable in the wild. There was no motivation to even bother taking IE6 out of quirks mode since the number of people using Gecko prior to FF is like the number of people using IE 5.01 today. That's not a ridiculous statement, that's how it was... and how companies like Amazon, Ebay and google CONTINUE to operate today... Let's face it so far as those companies are concerned standards compliance is the province of fringe whackos.

    How exactly DO you think the web came to be filled with so much rubbish invalid markup? From browser makers and site developers listening to the W3C and promoting standards complaince the past fifteen years? I think not.

    NEVER had a problem with min-height in IE7 - while absolute positioning bottom or right while broken in IE, don't exactly work right in gecko either so it's a 'non-deployable' concept.
     
    deathshadow, Dec 14, 2008 IP
  9. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #9
    Standards rise out of innovation. Standards are not created to invent things.
    None of those were ever in the standard.
    Agree and Microsoft is now paying the price. They've lost 25% market share in the last 3 years and have done so almost every month.
    Because IE was the most used so if you didn't code to IE then it wouldn't work. Besides, browsers are to make the best of invalid markup so, if it worked in IE, that's all that mattered.

    But most of what you are talking about is in the past. That was then. This is now. The internet is movinig forward and requiring all kinds of innovative methods that only work in modern, standards compliant browsers. Follow the standard or die, as IE, so far, is doing.
    Yes, IE7 is better than IE6, but that's like sayijng IE6 is better than IE5. So what? IE8 isn't even out yet and it won't be better than FF3 or Opera or Safari or Chrome were a year ago.
    Like I said, that was then, this is now.
    Again, go to w3.org and look up the membership list. 414 members I think you've heard of before.
    On replaced elements, it screws up if you specify a width. It also triggers 'haslayout' if you don't allow for that. There's something else that I can't think of right now.
    position:absolute works perfectly in gecko. Don't know why you have problems. It is buggy in IE7 as you said.
     
    drhowarddrfine, Dec 14, 2008 IP
  10. motofoto

    motofoto Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    hmmmm. next time I will not talk about sensitive things like Microsoft, standards, open-source, identity column in RDBM....extra

    Guys, would you please stop fighting, no one is rich here like Microsoft or Sun or who ever, let us talk about poor people problems

    and please bofore I got fired.

    ok, ooook, oooooooooooook

    I have used JS for quick save for the situation, the result is the same in IE and FF. I notice something I don't understand

    alert(window.document.getElementById('containerDiv').style.height);

    This is showing an empty message box, it seems that js objects is not initialized with styles in the css...Any comments
     
    motofoto, Dec 15, 2008 IP