NICE Design System home

Helpers

Floats

Quickly float elements with .left or .right. Clear floats on a parent element with the .clearfix class.

Example: floats

Floated left
Floated right

_10
<div class="clearfix">
_10
<div class="left">Floated left</div>
_10
<div class="right">Floated right</div>
_10
</div>

There is also a clearfix() SASS mixin for use with custom components:


_10
.example {
_10
@include clearfix;
_10
}

Center block

Set an element to display: block and center via margin: auto. Available as a mixin (@include center-block;) and class (.center-block).

Example: center block

Center block

_10
<div
_10
class="center-block text-center"
_10
style="background: #eee; width: 200px"
_10
>
_10
Center block
_10
</div>

Text alignment

Change the text alignment of an element by adding .text-left, .text-right, .text-center or .text-justify to an element.

Example: text alignment

This is some left-aligned text

This is some right-aligned text

This is some center-aligned text

This is some justified text


_10
<p class="text-left">This is some left-aligned text</p>
_10
<p class="text-right">This is some right-aligned text</p>
_10
<p class="text-center">This is some center-aligned text</p>
_10
<p class="text-justify">This is some justified text</p>

Text wrapping

Use .text-nowrap to keep text on one line and stop it from wrapping, and use .text-truncate to add an an ellipsis to text that overflows its container.

Example: text wrapping

This is some text that doesn't wrap

This is some truncated text


_10
<div style="background: #eee; width: 80px">
_10
<p class="text-nowrap">This is some text that doesn't wrap</p>
_10
<p class="text-truncate">This is some truncated text</p>
_10
</div>

Text transformation

Transform the casing of text by adding .text-lowercase, .text-uppercase, or .text-capitalize to an element.

Example: text transformation

Lowercased text

Uppercased text

Capitalized text


_10
<p class="text-lowercase">Lowercased text</p>
_10
<p class="text-uppercase">Uppercased text</p>
_10
<p class="text-capitalize">Capitalized text</p>

Maintain ratio

Use for enforcing an aspect ratio for iframes, videos and other embedded media, for example YouTube videos. Maintains a specific aspect ratio across a responsive site.

16 to 9 ratio

React
HTML

_10
<MaintainRatio ratio="16:9">
_10
<iframe
_10
src="https://www.youtube.com/embed/h7FP4FEDWrA"
_10
height="500px"
_10
width="100%"
_10
title="YouTube video player"
_10
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
_10
></iframe>
_10
</MaintainRatio>

4 to 3 ratio

React
HTML

_10
<MaintainRatio ratio="4:3">
_10
<iframe
_10
width="100%"
_10
height="700px"
_10
src="https://www.youtube.com/embed/h7FP4FEDWrA"
_10
title="YouTube video player"
_10
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
_10
></iframe>
_10
</MaintainRatio>

Help improve this page

To help make sure that this page is useful, relevant and up to date, you can:

Need help?

If you've got a question about the NICE Design System, contact the team.