Forum:Select a section with CSS

Hello, I can't find a way to select a specific section through CSS, I'll explain it better: I want to change the style of the section named "Navigation" in all pages, the sections has this code Navigazione OTHER CODES my purpose is to add the style " " to the section, to avoid floating elements which will "break" the section like this:

Floating element

Navigation
It's quite simple to select the span through the id "Navigation", but adding  it's useless since the span's width is the same of the text. I need to select the  element, but only the one with that section. I looked at the CSS selectors, but I didn't find a method to select a parent element. Any ideas?


 * Parents can't be selected. CSS selectors can only navigate down the node tree, not up. Luckily, with MediaWiki, all  tags on a page are section headers.


 * So I have to manually add a template like Clear? Can I do anything with CSS instead?


 * Can't you just use ? I imagine you wouldn't want any floating block breaking the section heading line. — Sovq 19:12, December 15, 2011 (UTC)


 * That won't do... because some times a section has a floating element on the right (an image, a profile box...) and "clear" the section will add unnecessary white spaces if the section itself is very short. I "cleared" the left side of all sections though, because breaking the section header is ugly in my opinion. I want to clear both side only for the section named "Navigation", so if nobody has ideas I guess I'll use a template in each page.


 * If all else fails, you should be able to give the h2 in question its own id or class using site-wide JS, so that some CSS definition works on it:  -- NablaOperator 19:59, December 15, 2011 (UTC)