Forums

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

Home Forums CSS [Solved] Style certain tags without using class

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #195331
    Robert K S
    Participant

    I need to style certain del and ins tags on a page (but not others), but I don’t have the luxury of assigning those tags to classes because I have no control over the dynamic code that will be generating the markup for the tags. I’m not sure how to accomplish the styling of the tags.

    If it helps to illustrate the problem, I need “this that the other” to be styled differently from “hey hi ho there” without putting any class assignments in the del and ins tags:

    <p id="first"><del>this</del> <ins>that</ins> <del>the other</del></p>
    <p id="second"><del>hey</del> <ins>hi</ins> <del>ho there</del></p>

    I have the option of putting the affected tags into a larger element and giving that element a class or an ID (as in the example above), but I’m not sure how the CSS would need to look with that approach. Any suggestions? Thanks in advance.

    #195332
    Paulie_D
    Member

    Are the paragraph IDs for example purposes or do they have some basis in reality?

    #195334
    Robert K S
    Participant

    The IDs are for example purposes only.

    Don’t use the datetime or cite attributes.

    nth-of-type is nice to know about (and would have saved me a lot of headache ten years ago, before it existed) but it wouldn’t help much in this case.

    Don’t strain your brain over it. I gave up looking for a CSS solution and built a PHP solution. So the specific problem is solved but not the general one.

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