Linking to specific text on page
Menu Scroll to Text in URL
 

Scroll to Text in URL

When you want to position a visitor on a particular place on a page that relates to text that is relevant to the originating page, then a special construct of a URL will allow this. The code that does this is a little more complex that the code fragment and involves adding an event handler to the dialog box (green text).

I came across this when I was looking at lumberjack stuff.

The clicking on the code fragment below will demonstrate this.

The #:~:text= does the business

href="lumberjack.html#:~:text=second%20aldi%20gardenline"

As does the first link below.

Other options

:target - :target is a CSS Pseudo Class. other such Pseudo Classes are :hover, active, :link etc as related to hyperlinks.

The link below for All Pseudo Classes takes you to the W3C page spcifically about these classes.

Adding the event handller - "clickable text" - or adding an eventListener()

This is explained on another page.

Top

Links

Top

References:

Site design by Tempusfugit Web Design -