Center #
The .center utility can be used to horizontally center block-level items.
.center {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
cu.css include a handful of utilities. Utilities help to solve common, yet specific problems found throughout a project. They can be used with any element in any context.
According to cube.fyi:
“A utility, in the context of CUBE CSS, is a CSS class that does one job and does that one job well.”
It’s important to note, cu.css doesn’t make use of any third-party tooling to generate utility classes. Instead, create any additional utilities by hand, as and when they are required.
The CSS for these utilities can be found in assets/scss/utilities.
The .center utility can be used to horizontally center block-level items.
.center {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
The .text-center utility class can be used to center the horizontal alignment of inline-level content inside a block element or table-cell box.
.text-center {
text-align: center;
}
Use the .visually-hidden utility to visually hide an element in the browser while ensuring it’s still accessible to assistive technologies, such as screen readers.
/*
VISUALLY HIDDEN
@link: https://piccalil.li/quick-tip/visually-hidden/
*/
.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: auto;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
white-space: nowrap;
}
This is different from using the [hidden] attribute which will hide the content from both the browser and assistive technologies.
The .w-full utility class can be used to make an element fill the full width of its parent container. Particularly useful for buttons and form elements.
.w-full {
width: 100%;
}