Content deleted Content added
m syntaxhighlight lang="wikitext" |
c/e |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1:
<noinclude>{{Wikipedia how-to}}</noinclude><includeonly><div style="float:right; padding:0 1em;">{{navbar|Mxt/User CSS for a monospaced coding font|plain=y}}</div></includeonly>
You can consistently use a monospaced font with well-designed characters for coding (e.g., to distinguish clearly between <code>l</code>, <code>1</code>, and <code>I</code>, and between <code>O</code> and <code>0</code>, and between <code>-</code>, <code>−</code>, <code>–</code>, and <code>—</code>).▼
▲
Add something like one of the code snippets below into your {{samp|[[Special:MyPage/common.css]]}} page, replacing {{kbd|"Roboto Mono"}} with whatever your preferred coding font is ([https://fonts.google.com/specimen/Roboto+Mono Roboto Mono] was picked as a freely-available coding font for this example).▼
If
▲
This code will do the following:▼
* Apply a consistent monospace font of your choice (and the fallback system-default {{samp|monospace}}, should that font go missing or not have characters you need) to all the normally monospaced HTML elements like {{tag|code|o}}, {{tag|pre|o}}, etc.▼
* Do the same for additional site-wide classes (as identified so far, e.g. <code>.monospaced</code>) that output as monospace.▼
* Make the three most frequently encountered editing fields also use this font stack: the main editing window, the edit summary line, and the search entry box.▼
If you know of an additional class to add here, please update this page or mention it on [[Template talk:Mxt/User CSS for a monospaced coding font|the talk page]].▼
▲* Apply a consistent monospace font of
* Fallback to system-default {{samp|monospace}} font, should the chosen font be unavailable or lack the necessary characters.
* Do the same for the output of all [[:Category:Example-formatting templates|Example-formatting templates]], such as {{tlx|mxt}} and {{tlx|xt}}.
▲*
▲* Make the three most frequently encountered editing fields also use this font stack: the main editing window, the edit summary line, and the search entry box.
▲* If
<!--DO NOT ADD var TO THIS LIST! It must be able to inherit the font of surrounding text, because it is used outside code, as in "If <var>A</var> then <var>B</var>", and in math equations.-->
Line 50 ⟶ 51:
{{anchor|Cleanup efforts}}'''Cleanup efforts'''
If you'd like to help clean up instances of the {{tag|{{!mxt|tt}}}} element – which has
{{syntaxhighlight|lang=css|1=
Line 71 ⟶ 72:
It can also be used as a stand-alone how-to page; a redirect to it, [[Help:User CSS for a monospaced coding font]], is categorized as such. It is also transcluded as a section, at [[Help:User style#User CSS for a monospaced coding font]].
{{Wikipedia technical help}}
[[Category:
<!--End documentation.-->}}</noinclude>
|