Reboot CSS
Reboot is a collection of element-specific CSS changes in a single file to help kickstart building a site with the Fluent UI Blazor library. It provides an elegant, consistent, and simple baseline to build upon (inspired by Bootstrap's Reboot which again is based on Normalize.css)
If you want to use Reboot, like this demo site, you'll need to include it in your App.razor or index.html file like this:
<link href="/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css" rel="stylesheet" />
If you are creating a site by using our Templates package, this is already set up for you. You can
PS: It is entirely possible to build a site without using Reboot but you will have to do more styling yourself.
PSs: When creating a site that is hosted in a different base path,it might be necessary to remove the leading '/' from the stylesheet link.
Approach
Reboot builds upon Bootstrap's Reboot which itself builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors.
Here are our guidelines and reasons for choosing what to override in Reboot:
- Update some browser default values to use
rems instead ofems for scalable component spacing. - Avoid
margin-top. Vertical margins can collapse, yielding unexpected results. More importantly though, a single direction ofmarginis a simpler mental model. - For easier scaling across device sizes, block elements should use
rems formargins. - Keep declarations of
font-related properties to a minimum, usinginheritwhenever possible.
Page defaults
The <html> and <body> elements are updated to provide better page-wide defaults. More specifically:
-
The
box-sizingis globally set on every element—including*::beforeand*::after, toborder-box. This ensures that the declared width of element is never exceeded due to padding or border.- No base
font-sizeis declared on the<html>, but--type-ramp-base-font-size: 14px;is assumed (the Fluent UI default).font-size: var(--type-ramp-base-font-size)is applied on the<body>and can be overridden by modifying the--type-ramp-base-font-sizevariable.
- No base
- The
<body>also sets a globalfont-family(var(--body-font)),font-weight(var(--font-weight)),line-height(var(--type-ramp-base-font-size)), andcolor(var(--neutral-base-color);). This is inherited later by some form elements to prevent font inconsistencies. - For safety, the
<body>has a declaredbackground-color, defaulting tovar(--neutral-fill-layer-rest).
Headings and paragraphs
All heading elements—e.g., <h1>—and <p> are reset to have their margin-top removed. Headings have margin-bottom: .5rem added and paragraphs margin-bottom: 1rem for easy spacing.
| Heading | Example |
|---|---|
<h1></h1> |
h1. Fluent UI heading |
<h2></h2> |
h2. Fluent UI heading |
<h3></h3> |
h3. Fluent UI heading |
<h4></h4> |
h4. Fluent UI heading |
<h5></h5> |
h5. Fluent UI heading |
<h6></h6> |
h6. Fluent UI heading |
Lists
All lists—<ul>, <ol>, and <dl>—have their margin-top removed and a margin-bottom: 1rem. Nested lists have no margin-bottom. We’ve also reset the padding-left on <ul> and <ol> elements.
- All lists have their top margin removed
- And their bottom margin normalized
-
Nested lists have no bottom margin
- This way they have a more even appearance
- Particularly when followed by more list items
- The left padding has also been reset
- Here’s an ordered list
- With a few list items
- It has the same overall look
- As the previous unordered list
For simpler styling, clear hierarchy, and better spacing, description lists have updated margins. <dd>s reset margin-left to 0 and add margin-bottom: .5rem. <dt>s are bolded.
- Description lists
- A description list is perfect for defining terms.
- Term
- Definition for the term.
- A second definition for the same term.
- Another term
- Definition for this other term.
Inline code
Wrap inline snippets of code with <code>. Be sure to escape HTML angle brackets.
For example, <section> should be wrapped as inline.
Code blocks
Use <pre>s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. The <pre> element is reset to remove its margin-top and use rem units for its margin-bottom.
<p>Sample text here...</p>
<p>And another line of sample text here...</p>
Variables
For indicating variables use the <var> tag.
User input
Use the <kbd> to indicate input that is typically entered via keyboard.
To edit settings, press ctrl + ,
Sample output
For indicating sample output from a program use the <samp> tag.
Tables
Tables are slightly adjusted to style <caption>s, collapse borders, and ensure consistent text-align throughout. Additional changes for borders, padding, and more come with the .table class.
| Table heading | Table heading | Table heading | Table heading |
|---|---|---|---|
| Table cell | Table cell | Table cell | Table cell |
| Table cell | Table cell | Table cell | Table cell |
| Table cell | Table cell | Table cell | Table cell |
Forms
To maintain a consistent look and feel, we stongly advise you to use the Fluent Input components as described in the Form & inputs section. It is however also still possible of course to use the standard HTML input components. Most of them have been rebooted for simpler base styles. Here are some of the most notable changes:
<fieldset>s have no borders, padding, or margin so they can be easily used as wrappers for individual inputs or groups of inputs.<legend>s, like fieldsets, have also been restyled to be displayed as a heading of sorts.<label>s are set todisplay: inline-blockto allowmarginto be applied.<input>s,<select>s,<textarea>s, and<button>s are mostly addressed by Normalize, but Reboot removes theirmarginand setsline-height: inherit, too.<textarea>s are modified to only be resizable vertically as horizontal resizing often “breaks” page layout.<button>s and<input>button elements havecursor: pointerwhen:not(:disabled).
These changes, and more, are demonstrated below.
Date & color input support
Keep in mind date inputs are not fully supported by all browsers, namely Safari.
Pointers on buttons
Reboot includes an enhancement for role="button" to change the default cursor to pointer. Add this attribute to elements to help indicate elements are interactive. This role isn’t necessary for <button> elements, which get their own cursor change.
Misc elements
Address
The <address> element is updated to reset the browser default font-style from italic to normal. line-height is also now inherited, and margin-bottom: 1rem has been added. <address>s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with <br>.
1 Microsoft Way
Redmond, WA 98052
P: (425) 882-8080 Full Name
first.last@example.com
Blockquote
The default margin on blockquotes is 1em 40px.
A well-known quote, contained in a blockquote element.
Someone famous in Source Title
Inline elements
The <abbr> element receives basic styling to make it stand out amongst paragraph text.
Summary
The default cursor on summary is text, so we reset that to pointer to convey that the element can be interacted with by clicking on it.
Some details
More info about the details.
Even more details
Here are even more details about the details.
HTML5 [hidden] attribute
HTML5 adds a new global attribute named [hidden], which is styled as display: none by default. Borrowing an idea from PureCSS, we improve upon this default by making [hidden] { display: none !important; } to help prevent its display from getting accidentally overridden.
<input type="text" hidden>