I'm trying to target the first p tag inside a DIV, which is the container for blog content. There's markup before it, such as another div or an image.
#content_container > p {} works well to target the paragraphs within the container, but not the ones that are captions of another div, etc.
<div id="content_container"> <h1>title</h1> <div with a photo><p>this caption shouldn't be touched</p></div> <p>.................</p> <p>.................</p> </div>
But I can't seem to target JUST the first (or last) paragraph within the #content_container.
Thoughts?
#content_container > p:first-of-type {} works, but is unsupported up until MSIE9. There has to be an easier way to remove the margin at the top of the first paragraph w/o marking up the content. My only hope is JS? http://ie7-js.googlecode.com/svn/test/index.html
the generic div tag can be changed to the id name of the div with photo depending if you're going to have other divs followed by paragraphs later on in your #content_container.
Thanks for the brain power! Yes, the copy on the page is full of paragraphs with div tags between them, so something along those lines would certainly have to be specific.
I'm trying to target the first p tag inside a DIV, which is the container for blog content. There's markup before it, such as another div or an image.
#content_container > p {} works well to target the paragraphs within the container, but not the ones that are captions of another div, etc.
But I can't seem to target JUST the first (or last) paragraph within the #content_container.
Thoughts?
#content_container > p:first-of-type {} works, but is unsupported up until MSIE9. There has to be an easier way to remove the margin at the top of the first paragraph w/o marking up the content. My only hope is JS? http://ie7-js.googlecode.com/svn/test/index.html
the generic div tag can be changed to the id name of the div with photo depending if you're going to have other divs followed by paragraphs later on in your #content_container.