Re: Define <br> by CSS means?

You can do it already, almost as easily, with something along the lines of:

div>span:nth-child(3)::after {
	content: '\A';
	white-space: pre;
}

Lea Verou (http://lea.verou.me | @LeaVerou)

On Jul 20, 2012, at 22:30, Andrew Fedoniouk 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?
> 
> -- 
> Andrew Fedoniouk.
> 
> http://terrainformatica.com
> 

Received on Saturday, 21 July 2012 06:44:44 UTC