Forum Moderators: not2easy

Message Too Old, No Replies

Can style be based on element it follows?

changing margin-top of list based on what element it follows

         

mattknowles

6:58 pm on Feb 22, 2008 (gmt 0)

10+ Year Member



I have a client who wants the margin between a paragraph and a list to disappear. Right now I created a style for the special case where a paragraph precedes a list and manually apply it.

I would prefer to create a style for the list that would do one thing if it comes after a paragraph and another if it comes after a header.

Is this even possible in CSS? I seem to recall reading somewhere that you could do it but I don't know what the terminology would be to search on it.

It's not really nesting which I'm aware of how to do.

fside

5:03 am on Feb 23, 2008 (gmt 0)

10+ Year Member



Would the plus sign work, for adjacent-sibling? H2 + ULsty, or P + ULsty?

mattknowles

11:20 pm on Feb 23, 2008 (gmt 0)

10+ Year Member



I think that's what I was looking for. I'll give it a try. Thanks!