How to make a div ignore a property assigned by body tag?

Discussion in 'HTML' started by falconer, Aug 10, 2006.

  1. falconer

    falconer Guest

    I must work within a CMS which controls the styles attached to the body
    tag -- I cannot alter this:

    body {font-size: 13px}

    but I *can* change the style of a tag within the body, i.e., ---

    #wrap { }

    But I cannot figure out how to instruct the wrap division to ignore the
    instruction for the default font-size to be 13px. How can the font-size
    of the #wrap container be made to be whatever the browser's default may
    be?

    I have tried
    #wrap {font-size: normal}, or
    #wrap {font-size: normal!important}, or
    #wrap {font-size: 100%!important}, or
    #wrap {font-size: 100%}

    all without good result.

    Please, does anyone know how to cut this Gordian knot?

    Thanks!
     
    falconer, Aug 10, 2006
    #1
    1. Advertising

  2. falconer <> scripsit:

    > I must work within a CMS which controls the styles attached to the
    > body tag -- I cannot alter this:
    >
    > body {font-size: 13px}


    Sigh. Are you _sure_ you must work under such foolish constraints?

    > But I cannot figure out how to instruct the wrap division to ignore
    > the instruction for the default font-size to be 13px.


    Well, that's simple, e.g.

    #wrap { font-size: 16px; }

    Of course, fixed font sizes aren't a good idea. But if the _overall_ font
    size on a page is set in pixels, does it make sense to set the font size of
    some element in some different units?

    > How can the
    > font-size of the #wrap container be made to be whatever the browser's
    > default may be?


    By setting it to medium.

    > I have tried
    > #wrap {font-size: normal}, or


    Won't work, since there is no such value defined for the font-size property
    in CSS specifications; use

    #wrap { font-size: medium; }

    > #wrap {font-size: 100%!important}, or
    > #wrap {font-size: 100%}


    The percentage relates by definition to the font size of the enclosing
    element, so it won't help here. Note: The !important specifier is not
    needed, since _any_ setting of the font-size property for an element
    prevents the inheritance of the property value from the enclosing element.
    The specifier would be needed, though, if the overall style sheet contained
    e.g.

    * { font-size: 13px; }

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Aug 10, 2006
    #2
    1. Advertising

  3. falconer

    falconer Guest

    Thank you for the intelligent discussion.

    I have worked around the problem with this awful patch, inserted before
    the div I wish to free from the designer's bizarre decision to fix the
    font-size:
    <style>
    body {font-size: 100%}
    </style>

    <sigh>I feel bad, but it does seem to change everything which follows
    it. At least in the two browsers I tested. </sigh>

    Jukka K. Korpela wrote:
    > falconer <> scripsit:
    >
    > > I must work within a CMS which controls the styles attached to the
    > > body tag -- I cannot alter this:
    > >
    > > body {font-size: 13px}

    >
    > Sigh. Are you _sure_ you must work under such foolish constraints?
    >
    > > But I cannot figure out how to instruct the wrap division to ignore
    > > the instruction for the default font-size to be 13px.

    >
    > Well, that's simple, e.g.
    >
    > #wrap { font-size: 16px; }
    >
    > Of course, fixed font sizes aren't a good idea. But if the _overall_ font
    > size on a page is set in pixels, does it make sense to set the font size of
    > some element in some different units?
    >
    > > How can the
    > > font-size of the #wrap container be made to be whatever the browser's
    > > default may be?

    >
    > By setting it to medium.
    >
    > > I have tried
    > > #wrap {font-size: normal}, or

    >
    > Won't work, since there is no such value defined for the font-size property
    > in CSS specifications; use
    >
    > #wrap { font-size: medium; }
    >
    > > #wrap {font-size: 100%!important}, or
    > > #wrap {font-size: 100%}

    >
    > The percentage relates by definition to the font size of the enclosing
    > element, so it won't help here. Note: The !important specifier is not
    > needed, since _any_ setting of the font-size property for an element
    > prevents the inheritance of the property value from the enclosing element.
    > The specifier would be needed, though, if the overall style sheet contained
    > e.g.
    >
    > * { font-size: 13px; }
    >
    > --
    > Jukka K. Korpela ("Yucca")
    > http://www.cs.tut.fi/~jkorpela/
     
    falconer, Aug 10, 2006
    #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. shruds
    Replies:
    1
    Views:
    946
    John C. Bollinger
    Jan 27, 2006
  2. =?Utf-8?B?RGVkZ2U=?=

    VS 2005 <Body> and <Div> tag scroll properties

    =?Utf-8?B?RGVkZ2U=?=, Apr 10, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    803
    =?Utf-8?B?RGVkZ2U=?=
    Apr 11, 2007
  3. Rob Meade
    Replies:
    6
    Views:
    297
    Rob Meade
    Mar 1, 2004
  4. M Wells
    Replies:
    0
    Views:
    150
    M Wells
    Oct 6, 2004
  5. visu
    Replies:
    4
    Views:
    325
Loading...

Share This Page