Reboot sets consistent default styles for HTML elements and gives OUDS Web a simple starting point.
On this page
Approach
Reboot is a shared SCSS file imported after the root styles and before typography, layout, and component styles in each theme stylesheet. This order sets the basic styles first, later styles can then build on or override them.
Reboot builds on Normalize and sets default styles using element selectors. For example, reboot resets the default styling of lists, while the Bullet list component offers more stylized lists using classes such as .bullet-list or .bullet-list-default-color.
Reboot follows these guidelines:
- Use
pxinstead ofemfor fixed spacing, so zoom leaves more room for content. - Avoid
margin-top. Vertical margins can collapse; using only one margin direction keeps spacing predictable. - Use
pxmargins on block elements to make spacing consistent across screen sizes. - Set as few font properties as possible and use
inheritwhere possible. - Text has a
max-widthfor readability. Remove it with the.mw-nonewidth utility when needed.
CSS variables
Every OUDS Web CSS bundle (like ouds-web.css, ouds-web-reboot.css, or ouds-web-grid.css) includes _root.scss, which defines root-level CSS variables (also called custom properties). These variables are generated from Sass variables.
For example, consider these :root CSS variables for common :root styles:
@if $font-size-root != null {
--#{$prefix}root-font-size: #{$font-size-root};
}
--#{$prefix}body-font-family: #{inspect($font-family-base)};
--#{$prefix}body-font-size: #{$font-size-base};
--#{$prefix}body-font-weight: #{$font-weight-base};
--#{$prefix}body-line-height: #{$line-height-base};
--#{$prefix}body-letter-spacing: #{$letter-spacing-base}; // OUDS mod
@if $body-text-align != null {
--#{$prefix}body-text-align: #{$body-text-align};
}
@if $enable-bootstrap-compatibility {
--#{$prefix}body-color: #{$body-color};
--#{$prefix}body-color-rgb: #{to-rgb($body-color)};
--#{$prefix}body-bg: #{$body-bg};
--#{$prefix}body-bg-rgb: #{to-rgb($body-bg)};
--#{$prefix}emphasis-color: #{$body-emphasis-color};
--#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color)};
--#{$prefix}secondary-color: #{$body-secondary-color};
--#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color)};
--#{$prefix}secondary-bg: #{$body-secondary-bg};
--#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg)};
--#{$prefix}tertiary-color: #{$body-tertiary-color};
--#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color)};
--#{$prefix}tertiary-bg: #{$body-tertiary-bg};
--#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg)};
}
In practice, those variables are then applied in Reboot like so:
#{$ouds-root-selector} > * { // OUDS mod: instead of `body`
margin: 0; // 1
font-family: var(--#{$prefix}body-font-family);
font-synthesis: none; // OUDS mod // 5
font-size: var(--#{$prefix}body-font-size);
font-weight: var(--#{$prefix}body-font-weight);
line-height: var(--#{$prefix}body-line-height);
color: var(--#{$prefix}color-content-default); // OUDS mod: instead of `var(--#{$prefix}body-color)`
text-align: var(--#{$prefix}body-text-align);
/* rtl:remove */
letter-spacing: var(--#{$prefix}body-letter-spacing); // OUDS mod
background-color: var(--#{$prefix}color-bg-primary); // 2 // OUDS mod: instead of `var(--#{$prefix}body-bg)`
-webkit-text-size-adjust: 100%; // 3
-webkit-tap-highlight-color: rgba($black, 0); // 4
-webkit-font-smoothing: subpixel-antialiased; // OUDS mod
text-rendering: optimizespeed; // OUDS mod
}
Which allows you to make real-time customizations however you like:
<body style="--bs-body-color: #333;">
<!-- ... -->
</body>
Page defaults
Reboot sets consistent defaults for the page:
- Every element, including
*::beforeand*::after, usesbox-sizing: border-box. Padding and borders are included in the declared width. - Reboot does not set a font size on
<html>, so1remfollows the browser default (usually16px) and respects user preferences. Direct children of the root usefont-size: 1rem. Set a new$font-size-rootto override the browser default. - Direct children of the root receive the base
font-family,font-weight,line-height,color, andbackground-color.
Font stack
OUDS Web loads custom brand fonts from a CDN, to ensure optimum text rendering on every device and OS, and to benefit from the browser's cache.
If a custom font is unavailable, OUDS Web uses a system font stack for clear text rendering across devices. This stack is applied globally and defined here:
$custom-font-name: "Sosh";
// Map of CDN URLs for custom font, with weight as keys
$custom-font-cdn-urls: (
$ouds-font-weight-system-web-moderate: "https://assets.orange.com/pm_12751_481_481818-a5ae2tmj13--Sosh-Medium.woff2?a=1",
$ouds-font-weight-system-web-strong: "https://assets.orange.com/pm_12751_481_481815-qd9nelrt7o--Sosh-Bold.woff2?a=1"
);
$ouds-font-family-sans-serif-stack:
// OUDS custom font
$custom-font-name,
// Basic web fallback
Arial,
"Noto Sans",
"Liberation Sans",
sans-serif,
// Emojis fonts
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji";
Font-face rules are generated in _root.scss from the $custom-font-cdn-urls map. Update the URLs if you host the fonts elsewhere.
Code elements use the monospace stack below:
$ouds-font-family-monospace-stack:
// Windows
Consolas,
// Safari for macOS and iOS
"SFMono-Regular",
// Android
"Roboto Mono",
// Basic web fallback
"Liberation Mono",
Menlo,
monospace;
Headings
All heading elements—<h1>—<h6> have their margin-top removed, margin-bottom: 16px set, and line-height tightened. While headings inherit their color by default, you can also override it via optional CSS variable, --bs-heading-color. <h1>—<h6> elements are associated to heading typography. If you want to get rid of the margin-bottom, please use our .mb-none spacing utility. If you want to get rid of the max-width, please use our .mw-none width utility.
Paragraphs
All <p> elements have their margin-top removed and margin-bottom: 16px set for easy spacing. <p> uses body medium typography. If you want to get rid of the margin-bottom, please use our .mb-none spacing utility. If you want to get rid of the max-width, please use our .mw-none width utility.
This is an example paragraph which is long enough so it’s easy to see and compare the max-width in action and compare it to the one below.
This is an example paragraph which is long enough so it’s easy to see and compare the max-width in action and compare it to the one above.
This is an example paragraph.
<p class="mw-none mb-none">This is an example paragraph which is long enough so it’s easy to see and compare the <code>max-width</code> in action and compare it to the one below.</p>
<p>This is an example paragraph which is long enough so it’s easy to see and compare the <code>max-width</code> in action and compare it to the one above.</p>
<p>This is an example paragraph.</p>
Links
Links have bold and underline applied. While links change on :hover, by default they don’t change based on whether someone :visited the link.
<a href="#">This is an example link</a>
Links have a disabled style when using an aria-disabled="true" attribute.
<a aria-disabled="true">This is an example of a disabled link</a>
Visited links don’t have a specific style by default.
Placeholder links—those without an href—are targeted with a more specific selector and have their color and text-decoration reset to their default values.
<a>This is a placeholder link</a>
On colored backgrounds, links should have a different style. Visited links don’t have a specific style on colored backgrounds.
<div class="link-on-colored-bg">
<div class="bg-surface-brand-primary p-large">
<div data-bs-theme="root-inverted">
This is an example of a <a href="#">link on colored background</a> in a paragraph.
</div>
</div>
<div class="bg-surface-status-negative-emphasized p-large">
<div data-bs-theme="root-inverted">
This is an example of a <a href="#">link on colored background</a> in a paragraph.
</div>
</div>
</div>
<div class="link-on-colored-bg bg-surface-brand-primary p-large">
<div data-bs-theme="root-inverted">
This is an example of a <a href="." class="visited-links">link on colored background</a> in a paragraph.
</div>
</div>
Horizontal rules
The <hr /> element has been simplified. Similar to browser defaults, <hr />s are styled via border-top and automatically inherit their border-color via color.
<hr />
The <hr /> style can be modified with border utilities. See some customization examples in the Divider helpers documentation.
Lists
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 text elements
Styling for common inline HTML5 elements.
You can use the mark tag to highlight text.
This line of text is meant to be treated as deleted text.
This line of text is meant to be treated as no longer accurate.
This line of text is meant to be treated as an addition to the document.
This line of text will render as underlined.
This line of text is meant to be treated as fine print.
This line rendered as bold text.
This line rendered as bold text too, but would natively be italicized.
<p>You can use the mark tag to <mark>highlight</mark> text.</p>
<p><del>This line of text is meant to be treated as deleted text.</del></p>
<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
<p><u>This line of text will render as underlined.</u></p>
<p><small>This line of text is meant to be treated as fine print.</small></p>
<p><strong>This line rendered as bold text.</strong></p>
<p><em>This line rendered as bold text too,</em> but would natively be italicized.</p>
Beware that those tags should be used for semantic purpose:
<mark>represents text which is marked or highlighted for reference or notation purposes.<small>represents side-comments and small print, like copyright and legal text. It uses body small typography.<s>represents element that are no longer relevant or no longer accurate.<u>represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation.
If you want to style your text, you should use the following classes instead:
.markwill apply the same styles as<mark>..smallwill apply the same styles as<small>..text-decoration-underlinewill apply the same styles as<u>..text-decoration-line-throughwill apply the same styles as<s>.
While not shown above, feel free to use <b> and <i> in HTML5. <b> is meant to highlight words or phrases without conveying additional importance, while <i> is mostly for voice, technical terms, etc.
Code
<code> element uses code typography.
Inline code
Wrap inline snippets of code with <code>. Be sure to escape HTML angle brackets.
<section> should be wrapped as inline.
For example, <code><section></code> 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 px units for its margin-bottom.
<p>Sample text here...</p>
<p>And another line of sample text here...</p>
<pre><code><p>Sample text here...</p>
<p>And another line of sample text here...</p>
</code></pre>
Variables
For indicating variables use the <var> tag.
<var>y</var> = <var>m</var><var>x</var> + <var>b</var>
User input
Use the <kbd> to indicate input that is typically entered via keyboard.
To edit settings, press Ctrl + ,
To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br />
To edit settings, press <kbd><kbd>Ctrl</kbd> + <kbd>,</kbd></kbd>
Sample output
For indicating sample output from a program use the <samp> tag.
<samp>This text is meant to be treated as sample output from a computer program.</samp>
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 |
<table>
<caption>
This is an example table, and this is its caption to describe the contents.
</caption>
<thead>
<tr>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
<th>Table heading</th>
</tr>
</thead>
<tbody>
<tr>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
<tr>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
<td>Table cell</td>
</tr>
</tbody>
</table>
Forms
Various form elements 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.
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.
<span role="button" tabindex="0">Non-button element button</span>
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: 16px 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 />.
1123 Fictional St,
San Francisco, CA 94103
P: (123) 456-7890 Full Name
first.last@example.com
Blockquote
For quoting blocks of content from another source within your document, wrap <blockquote> around any HTML as the quote. The default margin on blockquotes is 1em 40px, so we reset that to 0 0 16px for something more consistent with other elements. <blockquote> uses body large text.
A well-known quote, contained in a blockquote element.
<blockquote>
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
Naming a source
The HTML spec requires that blockquote attribution be placed outside the <blockquote>. When providing attribution, wrap your <blockquote> in a <figure> and use a <figcaption>. Be sure to wrap the name of the source work in <cite> as well. <figcaption> after <blockquote> uses body small typography.
A well-known quote, contained in a blockquote element.
<figure>
<blockquote>
<p>A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption>
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
Alignment
Use text and spacing utilities as needed to change the alignment of your blockquote.
A well-known quote, contained in a blockquote element.
<figure class="text-center">
<blockquote>
<p class="mx-auto">A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption class="mx-auto">
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
A well-known quote, contained in a blockquote element.
<figure class="text-end">
<blockquote>
<p class="ms-auto">A well-known quote, contained in a blockquote element.</p>
</blockquote>
<figcaption class="ms-auto">
Someone famous in <cite title="Source Title">Source Title</cite>
</figcaption>
</figure>
Abbreviations
Stylized implementation of HTML’s <abbr> element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies.
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 />
To merely toggle the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document, use the .invisible class instead.