<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.filipefonseca.pt/index.php?action=history&amp;feed=atom&amp;title=Template%3AMxt%2FUser_CSS_for_a_monospaced_coding_font</id>
	<title>Template:Mxt/User CSS for a monospaced coding font - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.filipefonseca.pt/index.php?action=history&amp;feed=atom&amp;title=Template%3AMxt%2FUser_CSS_for_a_monospaced_coding_font"/>
	<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Template:Mxt/User_CSS_for_a_monospaced_coding_font&amp;action=history"/>
	<updated>2026-04-18T23:09:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>http://wiki.filipefonseca.pt/index.php?title=Template:Mxt/User_CSS_for_a_monospaced_coding_font&amp;diff=1924&amp;oldid=prev</id>
		<title>FilipeFonseca: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Template:Mxt/User_CSS_for_a_monospaced_coding_font&amp;diff=1924&amp;oldid=prev"/>
		<updated>2021-07-08T08:33:22Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Wikipedia how-to}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;&amp;lt;div style=&amp;quot;float:right; padding:0 1em;&amp;quot;&amp;gt;{{navbar|Mxt/User CSS for a monospaced coding font|plain=y}}&amp;lt;/div&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
You can consistently use a monospaced font with well-designed characters for coding (e.g., to distinguish clearly between &amp;lt;code&amp;gt;l&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;I&amp;lt;/code&amp;gt;, and between &amp;lt;code&amp;gt;O&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, and between &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;−&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;–&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;—&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Add something like one of the code snippets below into your {{samp|[[Special:MyPage/common.css]]}} page, replacing {{kbd|&amp;quot;Roboto Mono&amp;quot;}} 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).&lt;br /&gt;
&lt;br /&gt;
If you don't want to manually add this code to your CSS page but would rather &amp;lt;code&amp;gt;@import&amp;lt;/code&amp;gt; (transclude) it, see [[meta:User:SMcCandlish/codefont.css]] for quick instructions.&lt;br /&gt;
&lt;br /&gt;
This code will do the following:&lt;br /&gt;
* 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.&lt;br /&gt;
* Do the same for the classes used by {{tlx|mxt}} and other monospaced templates in the {{tlx|xt}} family&lt;br /&gt;
* Do the same for additional site-wide classes (as identified so far, e.g. &amp;lt;code&amp;gt;.monospaced&amp;lt;/code&amp;gt;) that output as monospace.&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
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]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--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 &amp;quot;If &amp;lt;var&amp;gt;A&amp;lt;/var&amp;gt; then &amp;lt;var&amp;gt;B&amp;lt;/var&amp;gt;&amp;quot;, and in math equations.--&amp;gt;&lt;br /&gt;
'''Horizontal style'''&lt;br /&gt;
{{syntaxhighlight|lang=css|1=&lt;br /&gt;
/* Use my font, when available, for code */&lt;br /&gt;
code, pre, samp, kbd, tt, .example-mono, .userlinks-username, .monospaced, .keyboard-key, .button, .plaincode { font-family: &amp;quot;Roboto Mono&amp;quot;, monospace !important; }&lt;br /&gt;
/*  Make some of the editable stuff monospaced */&lt;br /&gt;
#wpTextbox1, #wpSummary, #searchInput, #searchText { font-family: &amp;quot;Roboto Mono&amp;quot;, monospace !important; }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Vertical style'''&lt;br /&gt;
{{syntaxhighlight|lang=css|1=&lt;br /&gt;
/* Use my font, when available, for code */&lt;br /&gt;
code,&lt;br /&gt;
pre,&lt;br /&gt;
samp,&lt;br /&gt;
kbd,&lt;br /&gt;
tt,&lt;br /&gt;
.example-mono,&lt;br /&gt;
.userlinks-username,&lt;br /&gt;
.monospaced,&lt;br /&gt;
.keyboard-key,&lt;br /&gt;
.button&lt;br /&gt;
.plaincode {&lt;br /&gt;
  font-family: &amp;quot;Roboto Mono&amp;quot;, monospace !important;&lt;br /&gt;
}&lt;br /&gt;
/*  Make some of the editable stuff monospaced */&lt;br /&gt;
#wpTextbox1,&lt;br /&gt;
#wpSummary,&lt;br /&gt;
#searchInput,&lt;br /&gt;
#searchText {&lt;br /&gt;
  font-family: &amp;quot;Roboto Mono&amp;quot;, monospace !important;&lt;br /&gt;
}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{anchor|Cleanup efforts}}'''Cleanup efforts'''&lt;br /&gt;
&lt;br /&gt;
If you'd like to help clean up instances of the {{tag|{{!mxt|tt}}}} element – which has not been valid HTML since the 1990s, and should usually be replaced with {{tag|{{mxt|code}}}} (this may vary by context) – you can add something like the following to your {{samp|common.css}} to make {{tag|{{!mxt|tt}}|o}} stick out like a sore thumb:&lt;br /&gt;
&lt;br /&gt;
{{syntaxhighlight|lang=css|1=&lt;br /&gt;
/* Flag bad code for cleanup */&lt;br /&gt;
tt { color: DarkRed; background: Pink; }&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You can also do this with {{tag|font|o}}, {{tag|center|o}}, {{tag|strike|o}}, and other [[Wikipedia:HTML 5#Obsolete elements and attributes|deprecated elements]].  For CSS you can just import for this, see [[meta:User:SMcCandlish/lint.css]].&amp;lt;noinclude&amp;gt;&amp;lt;!--&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;{{Documentation|content=This is a documentation snippet page transcluded (without the banner or this doc section) into other template documentation, and into [[Help:User style]], for consistency. It takes no parameters.  &lt;br /&gt;
&lt;br /&gt;
Typical usage:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
== User CSS for a monospaced coding font ==&lt;br /&gt;
{{collapse top|left=y|title=Have monospaced templates in this group – and your editing window – use your preferred monospaced font:}}&lt;br /&gt;
{{Mxt/User CSS for a monospaced coding font}}&lt;br /&gt;
{{collapse bottom}}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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]].&lt;br /&gt;
{{Wikipedia technical help}}&lt;br /&gt;
[[Category:Template documentation]]&lt;br /&gt;
&amp;lt;!--End documentation.--&amp;gt;}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>FilipeFonseca</name></author>
	</entry>
</feed>