Re: Style rules to emulate HR

Bert Bos wrote:
> 
> Ian Hickson writes:
> >
> > This group has a long history of shooting down proposed CSS rules for
> > styling the default look of <br> elements, so I figured here would be the
> > best place to ask:
> >
> > What is wrong with the following?
> >
> >    br {
> >      display: block;
> >    }
> >
> >    br:before {
> >      content: "\A";
> >      white-space: pre; /* in case white-space applies to :before */
> >    }
> >
> >    br[clear=left] {
> >      clear: left;
> >    }
> >
> >    br[clear=right] {
> >      clear: right;
> >    }
> >
> >    br[clear=all] {
> >      clear: both;
> >    }
> >
> > (Other than the minor issue that for backwards compatability, the both
> > value for clear should actually clear the _bottom_ of the <br> and not the
> > top, like the rules above do.)
> 
> You will get an empty line too many.
> 
> The main problem of BR is that the first BR just starts a new line,
> without adding any vertical whitespace, but the second and subsequent
> ones create whitespace.
> 
> Setting the content of BR to "\A" (while keeping BR inline) will model
> that accurately, but doesn't allow for 'clear' to apply.
> 
> So how about:
> 
>     br              {content: "\A"; display: inline}
> 
>     br[clear]       {content: ""; display: block}
>     br[clear=left]  {clear: left}
>     br[clear=right] {clear: right}
>     br[clear=all]   {clear: both}

br, br[clear=none] {content: "\A"; display: inline} /*after br[clear]*/


Would the following markup present a problem, or do you want to
ignore the possibility?

<p>content<br>
<br clear="all">
<br clear="all">
<br clear="all">
end</p>

Received on Monday, 26 February 2001 21:40:28 UTC