Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS :first-child paragraph problem

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32205
    travelvice
    Member

    Howdy,

    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.



    title


    this caption shouldn't be touched


    .................


    .................



    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

    #52692
    DogsGhost
    Member

    div#content_container > div + p { : ;}

    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.

    #52693
    travelvice
    Member

    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.

    #52654
    soap
    Participant

    just use javascript. its so easy i don’t, know why people are afraid of it. =/

    #52651
    travelvice
    Member

    Indeed. Will have ie7.js on the page for PNG transparency, so might as well.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.