Relative width in CSS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • howa

    Relative width in CSS

    Hi,

    In Yahoo YUI Grid CSS,

    It specified the relative width of a container (e.g. 750px) by, e.g.

    width : 57.6293em; /* 750 div 13 */
    *width : 56.25em; /* 750 div 13.3333 for IE */

    1. Is this the standard way to define the width if we are using
    relative width?
    2. Should we also define the relative padding, margin using the above
    formula?

    Thanks.

  • Bergamot

    #2
    Re: Relative width in CSS

    howa wrote:
    >
    In Yahoo YUI Grid CSS,
    >
    It specified the relative width of a container (e.g. 750px) by, e.g.
    >
    width : 57.6293em; /* 750 div 13 */
    Huh? There is *no* such correlation between screen pixels and ems. Em is
    a measure of font size, which could be any value. I don't know where the
    13 comes from, but it is an arbitrary number at best.
    1. Is this the standard way to define the width if we are using
    relative width?
    Relative to what? If it's relative to window size, use %.

    I strongly advise against setting anything to 60em, unless it's
    max-width. If you used a large default type size like I do, you'd
    understand why.

    --
    Berg

    Comment

    • howa

      #3
      Re: Relative width in CSS

      On 4$B7n(B10$BF |(B, $B2<8a(B12$B ;~(B30$BJ,(B , Bergamot <berga...@visi. comwrote:
      howa wrote:
      >
      >
      Huh? There is *no* such correlation between screen pixels and ems. Em is
      a measure of font size, which could be any value. I don't know where the
      13 comes from, but it is an arbitrary number at best.
      13 mean the default font-size being used by YUI CSS, so the width is
      relative to the current font size, this is how YAHOO/YUI currently
      work. The advantage is when you zoom in using a larger font, the width
      of your container also increase.

      I found the above formula really work (hence..IE suck)

      I just wonder if any other has used this method if not.


      Howard

      Comment

      Working...