Re: Margin-color; text-indent; browser detection without script; attribute selector, ! combinator

On Mon, 8 Nov 1999, Matthew Brealey wrote:

> ---------------------------------------------------
> Margin-color:
> 
> It has always been a mystery to me why the CSS spec
> states that margins are always transparent. This means
> that you have to do this:
> BODY {background-color: black}
> DIV {margin-left: 5%;
> margin-right: 5%;
> background-color: red}
> <body>
> <div>
> </div>
> </body>

For this specific case, the same effect could be achieved with

  html { background-color: black; }
  body {
    margin-left: 5%;
    margin-right: 5%;
    background-color: red;
  }

Thus, you don't need the DIV (except to work around buggy browsers).

If margins weren't transparent, why have margins at all? The box model
already includes two opaque "boxes" around the content, the border (which
can optionally be transparent) and the padding.

> -------------------------------------------------------Attribute
> selectors:
> 
> At present TABLE[border="0"] does not match <table>,
> even though it actually has no border.
> 
> However, I would propose a refinement to the attribute
> selector, where
> TABLE[border=/"0"] matches TABLE with border
> explicitly 0 or at its initial value.

Interesting idea, but having a selector that would match when a specified
attribute is *not* set strikes me as a more flexible solution. Maybe
something like

  [!att]

Thus, to replicate the effect of your example:

  table[border="0"], table[!border]

> ------------------------------------------------------------------
> Error in CSS spec on text-indent:
> 
> The CSS spec states that % on text-indent relate to
> the width of the containing block.

Yes, I'm inclined to agree. One would expect "text-indent: 100%" to put
the beginning of the line all the way at the right side of the content
box; but under the current wording in the spec, a value of 100% could put
the beginning of the line a good deal farther to the right than that.

> ------------------------------------------------------------------
> ! combinator:
> 
> This seems like a good idea to me.
> 
> E.g. DIV.usedfordivision ! DIV {line-height: 14pt}
> Thus ! means the opposite of the combinator, so !
> means that it is the opposite of " " - i.e. it matches
> DIV that is not a descendant of DIV.usedfordivision.
> 
> Equally !> means not a child.

These are interesting, though I'm not sure what the proper compromise is
between utility and confusion in selector syntax. ;-)

-- 
Braden N. McDaniel
braden@endoframe.com
<URL:http://www.endoframe.com>

Received on Tuesday, 9 November 1999 07:40:18 UTC