Forums

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

Home Forums CSS CSS :first-letter AFTER a div element?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #273240
    z1334
    Participant

    I’m having an issue where the :first-letter works fine when there is no image above the paragraph text. I’m wondering how to resolve this when I have an image wrapped in a div element at the start of my post following with a paragraph? When there’s an img the first-letter of the paragraph goes to being normal size/color as the rest of the text. Here’s the CSS:

    .entry p:first-child:first-letter,
    .entry-page p:first-child:first-letter {
      font-weight: bold;
      color: #000;
      font-size: 0.875em;
    }
    

    I”m using the latest version of WordPress if that helps. Is there a specific way or a way in general to target the first-letter after a div element?

    #273241
    Paulie_D
    Member

    If there is an image (or any other element) before the paragraph them the paragraph is no longer a first-child.

    Without knowing the structure it’s hard to comment further but I’d suggest first-of-type rather than first-child here.

    https://codepen.io/Paulie-D/pen/dKqeRW

    #273242
    z1334
    Participant

    Oh my! Thank you so much! :D

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