CSS: Style for fixed character width font
Question by Compi | Last update on 2021-05-14 | Created on 2017-08-18
Is CSS offering any possibility for generally defining a font with a fixed character width for a text? Of course, I could also set the font-family to "Courier" or a similar font, but I do not know whether this font is installed on the user's device.
Therefore, I am searching for a more general way. Is there anything available in CSS for this?
Related Topics
Fonts for Windows, Linux and Mac on the Web
Article | 0 Comments
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Website Performance: Deliver JavaScript and CSS files compressed to reduce loading times
Tutorial | 0 Comments
jQuery: CSS Stylesheet Switcher
Tutorial | 1 Comment
Reload Images, CSS, JS and Web Pages despite Browser Cache
Tip | 2 Comments
Rewrite Text Files with a fixed Line Length
Tutorial | 0 Comments
HTML5 Canvas: Beginner Tutorial Chapter 4 - Write Text on Canvas
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You can specify a generic font family as CSS's font-family.
In your case this would be "monospace":
With specifying "font-family: monospace", the browser will care about selecting a fixed character width font for your text. Depending on the browser settings and the device, this may be "Courier New", "Consolas" or something else.
Other generic values are "serif" for fonts with serifs, "sans-serif" for a font without serifs, "cursive" for a handwriting script like Comic Sans or "fantasy" for a general uncommon font.
Last update on 2021-05-14 | Created on 2017-08-19