SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist ktown's Avatar
    Join Date
    May 2001
    Location
    toronto
    Posts
    478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    box model hack, only for IE or Opera also?

    Hey all

    i have this

    Code:
    #main {
      position:absolute; 
      margin-left:175px; 
      top: 115px; 
      z-index:1; 
      width: 512px;
      padding-right: 10px;
      border-right: 1px dotted #000000;
      }
    * html #main {
      width: 522px;
      }
    it fixed my problem with IE
    but in Opera it appears to be the same way that it used to be in IE before applied the hack?

    is this a known problem?

    i can publish the files if necessary.

    thanks in advance

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Do you have a full DOCTYPE on your page? If not, then Opera 7 goes into quirks mode now I believe

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I haven't seen the universal selector used for a box model hack before. It seems to me as though you have everything back to front anyway.

    Surely the * html #main should be 512px and the width in #main should be 523px (512+10+1).

    A quick check in Opera 7 and Mozilla 1.2 shows that they don't understand * html #main and do nothing. (They do however understand the universal selector on its own or with a class * .test. It seems its the * html they don't understand.)

    You could always use the child selector instead to supply Opera and Mozilla the correct size:
    Code:
    html>body #main{width:512px}
    But then wouldn't the ordinary (well tested ) box model hack have worked for you. (Or even better no hacks just separate the padding and borders into an inner element.)

    As I said I haven't seen the universal selector used like this and I may be missing the point somewhere

    Paul

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Paul,

    The * html bug allows for IE-only CSS.
    http://www.info.com.ph/~etan/w3panth...arhtmlbug.html

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi Vinnie,

    Thanks for the link, that clears it up for me.

    However, I don't see how it applies to Ktown's code.

    If the *html #main {width:522px} is supplying a width to just IE (Ie5 and 6) then surely ie5 will still use the broken box model and ie6 will use the correct box model (in standards mode).

    Compliant browsers will use the 512px width with the correct box model.

    I suppose it would work if you use IE6 in quirks mode.

    Are my assumptions correct (I will go and test them out anyway ).

    Paul

  6. #6
    SitePoint Evangelist ktown's Avatar
    Join Date
    May 2001
    Location
    toronto
    Posts
    478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i didn't even have a DOCTYPE

    so once i added it - and fixed the following - everything is now golden...

    Code:
    * html #main {
      width: 523px;
      w\idth: 512px;
      }
    thanks again
    i love sitepoint

  7. #7
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    * html #main { width: 523px; w\idth: 512px; }


    Now it makes sense

    Paul

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ktown

    i didn't even have a DOCTYPE

    so once i added it - and fixed the following - everything is now golden...
    It's always the DOCTYPE


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •