CSS3: box-sizing

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

    CSS3: box-sizing

    Hi,

    this has certainly been discussed within W3C, but I'd like to give my humble
    comment here, too...

    Using the current (CSS compliant) width/height handling it is not possible
    to easily add full width background to any block element.

    Currently, I'm responsible for adding a coloured background around headers
    for certain customers. The header background should be coloured and "width:
    100%;". Using IE quirks handling, I'd have written something like this:

    h1,h2,h3,h4,h5, h6,h7
    {
    background-color: green;
    color: black;

    width: 100%;

    padding: 1em 3em;
    border: 2px solid darkgreen;
    margin: 0 0 1em;
    }

    This works fine, no need to add a div, table or anything around each and
    every header element... However, in CSS 2.1 I can't find any setting that
    possibly could achieve something like this.

    So here's my personal vote to those being responsible to decide about new
    CSS specifications: Please positively add the "box-sizing" property to CSS.
    It will fill a gap in the current 2.1 specification for sure. [Again, this
    is just my humble opinion. Anyone coming up with a pure CSS 2.1 compliant
    solution, and I will immediately change my mind ;) ]

    Axel Dahmen


  • David Baron

    #2
    Re: CSS3: box-sizing

    > However, in CSS 2.1 I can't find any setting that[color=blue]
    > possibly could achieve something like this.[/color]

    'width: auto', which is the default value, will do what you want, as
    far as I can tell.

    -David

    --
    L. David Baron <URL: http://dbaron.org/ >

    Comment

    • Axel Dahmen

      #3
      Re: CSS3: box-sizing

      Thanks David, for giving me this hint! You are right, according to the specs
      your suggestion is going to work, I see it now. I forgot because I
      remembered a Netscape version - I believe it was v6 - which rendered a
      minimum box around blocks if I didn't explicitly set with to 100%. But, of
      course, it wasn't compliant at that time. Yet it stuck to my mind, though.

      Thanks for helping me out.

      Regards,
      Axel




      "David Baron" <dbaron@dbaron. org> schrieb im Newsbeitrag
      news:1104984382 .326718.94680@f 14g2000cwb.goog legroups.com...[color=blue][color=green]
      > > However, in CSS 2.1 I can't find any setting that
      > > possibly could achieve something like this.[/color]
      >
      > 'width: auto', which is the default value, will do what you want, as
      > far as I can tell.
      >
      > -David
      >
      > --
      > L. David Baron <URL: http://dbaron.org/ >
      >[/color]


      Comment

      Working...