simulating Compliance box model in Quirks mode

Discussion in 'HTML' started by Summercool, Mar 9, 2008.

  1. Summercool

    Summercool Guest

    Sometimes we are forced to use Quirks mode (such as embedding code in
    other people's profile box, etc).

    In that case, IE will show the box model by putting the "padding and
    border" inside the width and height, while Firefox and Safari will put
    it outside, the same as the CSS box model.

    Now, to hack around it, there is these solutions:

    http://webdesign.about.com/od/css/a/aaboxmodelhack.htm

    what is known as Tan hack or is it the same as Tantek hack... and it
    involves exploiting other bugs in the browser...

    but I wonder, why don't we just declare 3 div's


    <!-------------------- The code for Quirks mode -------------------->

    <body style="background:yellow">

    <div style="width:360px; height:360px; margin:0px; padding: 0px;
    border: 0px">
    <div style="padding:20px; border:10px solid black;background:eek:range">
    <div style="height:300px;width:300px;margin:0px;padding:0px;
    border:none;background:eek:range">

    Hello World

    </div>
    </div>

    </div>

    </body>

    <!--------------- The code for Standard Compliance mode ---------------
    >


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <body style="background:yellow">

    <div style="width:300px; height:300px; margin:0px; padding: 20px;
    border: 10px solid black;background:eek:range">

    Hello World

    </div>

    </body>


    So code #1 can simulate code #2, and it renders the same in IE and
    Firefox's quirks mode, without having to exploit any bug in browsers.

    and code #1, even if it is used in Standard Compliance mode, it would
    still render the same, regardless of what mode it is in...
    Summercool, Mar 9, 2008
    #1
    1. Advertising

  2. Summercool

    Bergamot Guest

    Summercool wrote:
    > Sometimes we are forced to use Quirks mode (such as embedding code in
    > other people's profile box, etc).


    I don't know what this profile box thing is, but why would that "force"
    you to use quirks mode?

    > Now, to hack around it, there is these solutions:
    >
    > http://webdesign.about.com/od/css/a/aaboxmodelhack.htm
    >
    > what is known as Tan hack or is it the same as Tantek hack...


    This is A Bad Thing. Don't use it.

    > but I wonder, why don't we just declare 3 div's


    Why don't you just use a strict doctype and fix the messy code from the
    profile box thing?

    > <!--------------- The code


    Post a URL, not code.

    --
    Berg
    Bergamot, Mar 9, 2008
    #2
    1. Advertising

  3. Summercool

    Guest

    On Mar 9, 3:59 pm, Bergamot <> wrote:
    > Summercool wrote:
    > > Sometimes we are forced to use Quirks mode (such as embedding code in
    > > other people's profile box, etc).

    >
    > I don't know what this profile box thing is, but why would that "force"
    > you to use quirks mode?


    the profile box is, such as in MySpace or Social Networking website,
    if you develop an app, then you provide the code inside that
    profile... they display it as an iframe, but they add the
    <html><head> ... at the beginning of the code so your doctype never
    get noticed by the browser.

    i was thinking of using javascript document.compatMode =
    "CSS1Compat"; except this property is only readable but not settable.
    , Mar 15, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Thies

    quirks mode and IE5 vs IE6

    Jeff Thies, Feb 12, 2004, in forum: HTML
    Replies:
    26
    Views:
    2,466
    =?ISO-8859-1?Q?Andr=E9s_Sedano?=
    Feb 14, 2004
  2. Michael Jaeger

    quirks mode

    Michael Jaeger, Apr 28, 2004, in forum: HTML
    Replies:
    10
    Views:
    885
    Jeff Thies
    May 5, 2004
  3. Simon Brooke
    Replies:
    4
    Views:
    459
    Johannes Koch
    Mar 23, 2007
  4. patrick j
    Replies:
    7
    Views:
    361
    Andy Dingley
    Apr 2, 2007
  5. Kornél Pál
    Replies:
    2
    Views:
    1,607
    Kornél Pál
    May 11, 2009
Loading...

Share This Page