CSS formatting conditional on the page a viewer arrives from?

The situation:

I have a website with (say) 3 pages A, B and C.

On each page is a link to the others, so on A there’s a link to B and a link to C etc etc

On page B is a line of black text of class “ReadMe”. I want this class to have a transition effect (say, a fade change of colour from gold to black) on page load, but ONLY if the page is loaded from the link on page C. If the link is from page A (or from anywhere else on the web) there should be no transition effect.

I haven’t made any attempts so far - I’m not even sure how to define what I want to do in a codeable form. Is this possible in CSS using globals at all?? Javascript perhaps?

Hi michael_priest, welcome to the forums!

It could be done with the help of Javascript that detects the origin of the link in page C. In that case the topic should move to the Javascript Forum. :slightly_smiling_face:

I think it also could be done with pure css to make the “ReadMe” get a transition by targeting it indirectly from the C page. :slightly_smiling_face:

Hi Erik, thanks for the suggestions. The :target idea handles the transition side well and it’s trivially simple to set the page C link (from the situation above) , but unfortunately as a target it jumps down the page (as you’d expect - that’s it’s function). I’ll look into the javascript idea.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.