Support » Themes and Templates » dynamic pseudo class needed? first-child? dunno! help!

  • So, what I want to do is have the first image that shows up on a blog post fit the width of the post so it looks like a headline image. however, I need the text that comes after it in the <p> elements to have a right and left padding of 10px and I want it to do the same for each and every <p> that comes after an <img>

    This is what I’ve got…and it works for the <img> element if I switch the P and IMG, but that defeats the purpose of what I want to do…so! Here’s what I’ve got so far. Any input is greatly, greatly appreciated. It looks so simple but it’s just not working and I’m relatively new with pseudo-classes…so I’ve got no idea:

    img > p:first-child {
    	padding-left: 10px;
    	padding-right: 10px;


Viewing 1 replies (of 1 total)
  • Can you give me a link or show me a sample of your code?

    I don’t think that will work because the paragraph tag won’t be inside the image tag. You might be able to reverse it and have something like:

    <p><img src="#" />Text Goes Here</p>

Viewing 1 replies (of 1 total)
  • The topic ‘dynamic pseudo class needed? first-child? dunno! help!’ is closed to new replies.