Fixed headings and anchors

About the template and stylesheet - and changing the menu
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Fixed headings and anchors

Post by cmb » Thu Jul 30, 2015 5:26 pm

Hi everybody!

Often there is a problem with fixed-positioned headers and anchors on a page: navigation pushes the anchor position underneath the heading. Recently I learned about a CSS3 only solution (doesn't require JavaScript): the :target pseudo-selector can be used, e.g.

Code: Select all

:target {padding-top: 50px}
Christoph M. Becker – Plugins for CMSimple_XH

lck
Posts: 2967
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Fixed headings and anchors

Post by lck » Fri Jul 31, 2015 12:17 pm

Thank you for sharing.
The :target Selector, is also usefull for mobile friendly menus.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Post Reply