* Timothy Kelty wrote: >I have some default styles set up to always float an image when its >inside of a <p>, like so: > >p img { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } > >I want to have a selector that zeros the top margin IF the <img> is >immediate child of the <p>, with no paragraph text between them. > >Currently I just use: > >p img.top { margin-top: 0; } > >...But I'm trying to figure this out without manually having to place >the class on there with a more advanced selector. It seems like I >need an 'adjacent child' selector, but it doesn't seem to exist. Any >ideas?
There are http://www.w3.org/TR/css3-selectors/#sibling-combinators but there is currently nothing that allows you to specify the "no text be- tween them" requirement, you could only use :first-child which then only looks at the elements. -- Björn Höhrmann · mailto:[EMAIL PROTECTED] · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ ______________________________________________________________________ css-discuss [EMAIL PROTECTED] 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/