Previous Message
Next Message

Combinators: How to Address Multiple Successive <br/>Tags

Sent by Alan Gresley on 17 April 2010 00:12


Rick Gordon wrote:
> I maintain a Blogger site for a non technical user. Since (unless you explicitly tag it otherwise)
a pblog post consits of a single paragraph, and uses <br/> tags (mapped to the user's carraige
returns). 
> 
> I would like to set up a means of increasing space under these breaks, but not multiplying the
increase if 2 or more breaks are inserted in succession.
> 
> So I made a br style:
> 
> .post-body br {
> display:inline-block;
> margin-bottom: .75em;
> }
> 
> This handles single breaks fine, but the space gets too big if multiple breaks are used.
> 
> So I tried both of the following:
> 
> .post-body br - br {
> display:inline;
> margin-bottom: 0;
> }


There is no such combinator as '-'.


> .post-body br + br {
> display:inline;
> margin-bottom: 0;
> }
> 
> ... but what happens in either case is that breaks after the first one are affected, even if they
are not in immediate succession. Any suggestions as to how I might achieve my aim here? There's no
way the user is going to deal with HTML for this, so CSS is the only hope.
> 


How about this.

..post-body br:first-child {
display:inline-block;
margin-bottom: .75em;
}


This will only target the first <br> in the element .post-body.


-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: