W3C home > Mailing lists > Public > www-style@w3.org > July 2012

Re: Define <br> by CSS means?

From: Jon Rimmer <jon.rimmer@gmail.com>
Date: Sat, 21 Jul 2012 22:16:53 +1000
Message-ID: <CA+ZDCiAnhnH87Xrr-z1fZoe+3svkRC6vWcvSaJNiL_AUZE_ddg@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: www-style@w3.org
On 21 July 2012 15:30, Andrew Fedoniouk <news@terrainformatica.com> wrote:

> Let's say we have this markup:
>
> <div>
>    <span>1</span>
>    <span>2</span>
>    <span>3</span>
>    <span>4</span>
>    <span>5</span>
>    <span>6</span>
> </div>
>
> and the desire to see these spans broken into two lines:
>   123
>   456
>
> with div style defined as:
>
> div { max-width: max-content; border:1px solid; }
>
> so its width will be set set to max of widths "123" and "456".
>
> Of course we can use <br> in markup between 3 and 4 but it is not CSS-ish.
>
> Something like this:
>
>   div>span:nth-child(3) { line-break:after; }
>
> probably?


It feels like this is another example of a weakness that Ian Hickson
identified with the CSS: the inability to select a group of elements to
create an anonymous container that can be styled. [1]

Using his suggested syntax, this could be done as follows:

div::group(span:first-child...span:nth-child(3)) {
    display: block;
}

[1] http://lists.w3.org/Archives/Public/www-style/2012Feb/0193.html

Jon Rimmer
Received on Saturday, 21 July 2012 12:17:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:57 GMT