W3Schools
w3schools.com › html › html_css.asp
HTML Styles CSS
An inline CSS uses the style attribute of an HTML element. The following example sets the text color of the <h1> element to blue, and the text color of the <p> element to red:
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS
CSS: Cascading Style Sheets | MDN
Mix two colors in any color space using the color-mix() function and copy the resulting color in any CSS color format.
Videos
21:53
CSS Introduction: Formatting Web Pages - YouTube
06:17
HTML & CSS for Absolute Beginners: CSS syntax / formatting CSS ...
06:15
Make Your Text Beautiful with CSS: Text-Formatting Tutorial - YouTube
03:58
HTML & CSS for Absolute Beginners: Creating and linking to a CSS ...
11:08:10
CSS Tutorial – Full Course for Beginners - YouTube
26:34
Beginner’s guide to styling text with CSS - YouTube
CleanCSS
cleancss.com › css-beautify
CSS Formatter
Enter your messy, minified, or obfuscated CSS Style Sheets into the field above to have it cleaned up and made pretty. The editor above also contains helpful line numbers and syntax highlighting. There are many option to tailor the beautifier to your personal formatting tastes.
File Format Docs
docs.fileformat.com › web › css
CSS File Format
October 11, 2019 - CSS (Cascading Style Sheets) are files that describe how HTML elements are displayed on the screen, paper, etc. With HTML, you can have either embedded styles or styles can be defined in an external stylesheet. For embedding the styles, the <style></style> tags are used.
MDN Web Docs
developer.mozilla.org › en-US › docs › MDN › Writing_guidelines › Code_style_guide › CSS
Guidelines for writing CSS code examples - MDN Web Docs | MDN
The following guidelines cover how to write CSS example code for MDN Web Docs. Opinions on correct indentation, whitespace, and line lengths have always been controversial. Discussions on these topics are a distraction from creating and maintaining content. On MDN Web Docs, we use Prettier as a code formatter ...
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Styling_basics › Getting_started
Getting started with CSS - Learn web development | MDN
The next example shows the same CSS in a more compressed format, with all extra white space removed.
W3Schools
w3schools.com › css › css_howto.asp
How to add CSS
CSS Reference CSS Selectors CSS Combinators CSS Pseudo-classes CSS Pseudo-elements CSS At-rules CSS Functions CSS Reference Aural CSS Web Safe Fonts CSS Animatable CSS Units CSS PX-EM Converter CSS Colors CSS Color Values CSS Default Values CSS Browser Support ... When a browser reads a style sheet, it will format the HTML document according to the information in the style sheet.
FreeFormatter
freeformatter.com › css-beautifier.html
Free Online CSS Beautifier / Formatter - FreeFormatter.com
Formats a CSS files with the chosen indentation level for optimal readability.
W3Schools
w3schools.com › css › css_intro.asp
CSS Introduction
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
Scaler
scaler.com › home › topics › css › css formatter
Free CSS Formatter Online and Beautifier
One of the best features of Scaler Topics’ CSS Formatter is that it supports various CSS indent levels, allowing you to choose the one that works best for your coding style. Whether you prefer 2, 3, or 4 spaces for indentation, the tool has got you covered. Below is an example of CSS code ...
Elementor
elementor.com › home › css formatter
CSS Formatter: Free Online CSS Beautifier
August 4, 2025 - Simply paste your raw CSS code into the input area. Many tools also allow you to upload a .css file directly. ... Select your desired formatting options, such as indentation level (e.g., 2 spaces, 4 spaces, or tabs).
W3C
w3.org › Style › Examples › 011 › firstcss.en.html
Starting with HTML + CSS
So far it contains the title of ... add the CSS style sheet there, too. The <body> is where the actual text of the document goes. In principle, everything in there will be displayed, except for the the text inside <!-- and -->, which serves as a comment to ourselves. The browser will ignore it. Of the tags in the example, <ul> introduces ...
W3Schools
w3schools.com › css › css_text.asp
CSS Text
This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified. The underline is removed from this colored "Try it Yourself" link. Try it Yourself » · The color property is used to set the color of the text. The color is specified by: ... Look at CSS Color Values for a complete list of possible color values.
LOC
loc.gov › preservation › digital › formats › fdd › fdd000482.shtml
Cascading Style Sheet (CSS) File Format
Format Description for CSS -- a style sheet language used for specifying the rendering of a document written in a markup language. Primarily used for applying styles to HTML documents; also applicable to XML and SVG files. Free-standing CSS files can act as style sheets for many documents, ...
Top answer 1 of 6
134
Sharing an example I use in website, I do use following pre in my stylesheet:
pre {
background: #f4f4f4;
border: 1px solid #ddd;
border-left: 3px solid #f36d33;
color: #666;
page-break-inside: avoid;
font-family: monospace;
font-size: 15px;
line-height: 1.6;
margin-bottom: 1.6em;
max-width: 100%;
overflow: auto;
padding: 1em 1.5em;
display: block;
word-wrap: break-word;
}
This gives the following results:

Disclaimer: In my leisure time, I have spend few hours to update this CSS with a bit extra features like code lines and code Copy button using CSS with JavaScript to my personal use that I like to share. Please use as you like github source code. To see a code example in real world, check this article from my blog that show how I use the code sample.
2 of 6
53
This javascript library seems excellent:
https://highlightjs.org/
UPDATE: I also used this on my Tumblr-based blog because it was easiest to deploy:
https://github.com/google/code-prettify
CKAN
docs.ckan.org › en › 2.9 › contributing › css.html
CSS coding standards — CKAN 2.9.11 documentation
.prose p { font-size: 1.1666em /* 14px / 12px */; } .ie7 .search-form { /* Force the item to have layout in IE7 by setting display to block. See: http://reference.sitepoint.com/css/haslayout */ display: inline-block; }
Static.app
static.app › css-formatter
CSS Formatter Online - Static.app
It is a fully online, browser-based tool, meaning you can start formatting your CSS code immediately without setting up any software. ... To format CSS, paste your CSS code into the formatter's text area or upload a CSS file. Click the "Format" button, and the tool will clean up your code by adding proper indentation and spacing.