Forums

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

Home Forums JavaScript How to place a link after every nth paragraph using css

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #161144
    kwarr
    Participant

    The situation: a page with hundreds of single-paragraph testimonials for a doctor.

    The need: to put a ‘top of page’ link after every 5th paragraph

    The problem: p:nth-of-type(5n):after { content:"xx"; } can only contain text, not a link

    The question: is there a css solution to this? I’m not good at javascript!

    Kip

    #161153
    Paulie_D
    Moderator

    Nope…only JS can actually add actual content elements for you.

    Plus…hundreds is waaaay too many….no-one will read that many. Try no more than 10….and even that seems excessive.

    #161191
    kwarr
    Participant

    Thanks, Paulie_D. I’ll struggle on with JS.

    I agree it is too much but it is the doctor’s orders!

    #161195
    Paulie_D
    Moderator

    Moved to JS section to see if anyone can assist.

    #161225
    __
    Participant

    You might use a “scroll-to-top script” instead of placing actual links. More user-friendly, IMO.

    And, if you did want to use css only, you could just make one link and give it a fixed position.

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