Template:Anchor highlight
Page Template:Anchor highlight.css/styles.css has no content.
Purpose
This template allows compatible deep linking and highlighting using the CSS :target feature, which is supported by most browser versions released since 2009, while support for text fragment URLs (#:~:) has only started to roll out in 2020.
It also serves the benefit of shorter URL fragments that can be conveniently memorized and manually typed.
Usage
For unformatted, plain text:
{{anchor highlight|anchor_id|Highlighted text}}
For any text transcluded through MediaWiki templates which includes an equality sign (=), the parameter numbers need to be included, in this case |2=. Otherwise, the text will not render and appear on the page, because MediaWiki considers the text before the equality sign be the parameter name.
{{anchor highlight|anchor_id|2=Highlighted text with the “=” character in it}}
Clicking here highlights Page Template:Anchor highlight.css/styles.css has no content.this text (unhighlight).
In order for this to work, your userspace common.css or MediaWiki:common.css must contain the following code:
.anchor-highlight:target
> .anchor-highlight-inner {
display: inline;
pointer-events: auto;
background-color: gold;
border-radius: 0.2em;
color: black;
line-height: 1em;
padding-top: 0;
}
Feel free to adapt it to your own preferences.
See also
{{anchor}}
| The above documentation is transcluded from Template:Anchor highlight/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |
