• I have this HTML
    <br/><label>Phone:</label> 7576XXXXXX

    Is there a css selector to target that specific label and text?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Anonymous User 16453565

    (@anonymized-16453565)

    Hi,

    Do you have any parent div for this? if you have then give css like below example
    .parentdiv then count the number of label and give child element css.

    Thanks

    Thread Starter adsler26

    (@adsler26)

    Hi,

    Thanks for your reply.

    Yes, it’s .awpcp-subtitle

    So seems to be the 2nd child.

    .awpcp-subtitle nth-child { background-color: green;}

    ?

    Thread Starter adsler26

    (@adsler26)

    Tried that. Doesn’t work. Doesn’t work with first-child either

    Thread Starter adsler26

    (@adsler26)

    More html

    div class="awpcp-subtitle">Contact Information</div>
    									<a href="https://adsler.co.uk/wp-user-test-dashboard-2/awpcp-reply-to-ad/13/madame-bovary/">Contact Anonymous</a>
    									<br/><label>Phone:</label> 7576XXXXXX
    									<br/><label>Location:</label> London, UK
    Thread Starter adsler26

    (@adsler26)

    Ok, i tried

    .awpcp-subtitle: first-child {background-color: green;}

    .awpcp-subtitle:nth-child(odd) 
    {background-color: green;}
    .awpcp-subtitle:nth-child(2)
    {background-color: green;}

    These work but don’t select labels, instead they select the text immediately after parent divs awpcp-subtitle

    • This reply was modified 6 years, 1 month ago by adsler26.

    Is this used in a popup or something? I display the site code and I don’t see any of the elements that are using the classes you’re posting. Can you post the code where this is used? Without knowing that it only a guessing game.

    when you’re using nth-child you want to point it to the container that is surrounding the label tag. then add the label to it. Example

    .awpcp-subtitle:nth-child(2) label

    Thread Starter adsler26

    (@adsler26)

    Hi,

    Thanks for your reply.

    Please see ‘more html’ above for html.

    Regarding the label thing, that didn’t work and I’m also unclear about how it would determine which label.label doesn’t donate any specific label.

    Is there a way of directing it to a specific label?

    Thanks,

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Css selector for specific label and phone number’ is closed to new replies.