mlut documentation

4 #css_lib CSS library

Small and optional CSS library with basic styles and helpers. The library is in the @mlut/core package, so you need to import it from there. This package is installed when mlut is used in any way

Source: content/main.css, line 1653

4.1 #css_lib.helpers Helpers

Set of universal helpers for using on any project

Source: content/main.css, line 1671
Example
Markup: ../examples/css_lib-helpers/btn/btn.html
<a class="btn test-content" href="#">Button</a>
Source: ../packages/core/src/sass/css/helpers/btn.scss, line 3

4.1.2 #css_lib.helpers.gs-debug Grid-system debug

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

Helper for debugging layouts that built with grid system. It displays a grid system columns and gutters in the background of the container. The grid system are generated depending on the settings.

There may be minor inaccuracies in the drawing of the grid, because the grid is generated with CSS linear-gradient(). For gutters calculation are used CSS custom properties.

It not included in the default mlut distributive.

Example

1

2

3

Markup: ../examples/css_lib-helpers/grid-debug/grid-debug.html
<div class="row gs-debug">
	<div class="row__col sm_W1gc W1c_md">
		<div class="test-content">
			<h3>1</h3>
		</div>
	</div>
	<div class="row__col sm_W1gc md_W2gc">
		<div class="test-content">
			<h3>2</h3>
		</div>
	</div>
	<div class="row__col sm_W1gc md_W8gc">
		<div class="test-content">
			<h3>3</h3>
		</div>
	</div>
</div>
Source: ../packages/core/src/sass/css/helpers/gs-debug.scss, line 3

4.1.3 #css_lib.helpers.ratio-box Ratio-box

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

Helper for creating containers, with proportional width and height. Implemented using a pseudo-element with a padding-bottom in %.

The default aspect ratio is 16:9.

Examples
Default styling
Some content here

[12:41:28] Starting 'style'... [12:41:29] mlut.min.css 12896 B (gzipped)

Block for creating containers, with proportional width and height. The default aspect ratio is 16: 9

.Pt75p_b
4:3 aspect ratio.
Some content here

[12:41:28] Starting 'style'... [12:41:29] mlut.min.css 12896 B (gzipped)

Block for creating containers, with proportional width and height. The default aspect ratio is 16: 9

.Pt100p_b
1:1 aspect ratio.
Some content here

[12:41:28] Starting 'style'... [12:41:29] mlut.min.css 12896 B (gzipped)

Block for creating containers, with proportional width and height. The default aspect ratio is 16: 9

Markup: ../examples/css_lib-helpers/ratio-block/ratio-block.hbs
<div class="ratio-box {{modifier_class}} test-row md_W25p">
  <div>
		<b>Some content here</b>
		<p>[12:41:28] Starting 'style'... [12:41:29] mlut.min.css 12896 B (gzipped)</p>
		<p>Block for creating containers, with proportional width and height. The default aspect ratio is 16: 9</p>
	</div>
</div>
Source: ../packages/core/src/sass/css/helpers/ratio-box.scss, line 3

4.1.4 #css_lib.helpers.row Row

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

Helper for creating layouts. Suitable for columns, cards and horizontal lists. By default, flexbox technology is used for layouts.

Parts of the layout within a row are created using the elements:

Rows can be put into each other an unlimited number of times.

Row contains CSS counter named ml-row-item.

It not included in the default mlut distributive because partially based on the legacy grid system. It is recommended to use the CSS grid utilities instead.

Example

sm_W2gc md_W3gc

Et molestie ac, massa, eget egestas purus viverra?

sm_W2gc md_W4gc

Et molestie ac, ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra?

sm_W2gc md_W5gc

Et molestie ac, feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra?

Markup: ../examples/css_lib-helpers/row/row.html
<div class="row">
	<div class="row__col sm_W2gc md_W3gc">
		<h3>sm_W2gc md_W3gc</h3>
		<p>Et molestie ac, massa, eget egestas purus viverra?</p>
	</div>
	<div class="row__col sm_W2gc md_W4gc">
		<h3>sm_W2gc md_W4gc</h3>
		<p>Et molestie ac, ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra?</p>
	</div>
	<div class="row__col sm_W2gc md_W5gc">
		<h3>sm_W2gc md_W5gc</h3>
		<p>Et molestie ac, feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra?</p>
	</div>
</div>
Source: ../packages/core/src/sass/css/helpers/row.scss, line 3

4.1.4.1 #css_lib.helpers.row.row__col row__col

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

The main element for creating columns in layout. By default, it stretches the entire width of the container. The columns have gutters on the sides and bottom.

The gutters are implemented using the margin and CSS custom properties.

Column width is set using W utility. See example above. The formulas for calculating the width and offset for the column are stored in the custom properties. In --ml-gscf for W and --ml-gsof for Ml utility. These formulas:

--ml-gscf: calc(var(--ml-gsc) / var(--ml-gscc) * 100% - var(--ml-gsfd, var(--ml-gg)) * 2);
--ml-gsof: calc(var(--ml-gso) / var(--ml-gscc) * 100% + var(--ml-gsfd, var(--ml-gg)));

--ml-gsc or --ml-gso is the value of the width or offset in the grid columns. This is a custom property of the utility.
--ml-gscc - the number of columns in the grid system. This is a global custom property that can be changed on any DOM node.
--ml-gsfd - variable is equal to the gutter if the gutter at the columns is created using margin. In row__col is equal 1gg.
Some of these variables can be changed using custom utilities.

You can create nested layouts with a mix of row and row__col on the same DOM node. If you don't need double fields in the nested row, use the mix with the row__item. See example below.

Example

Parent .md_W9gc

this .md_W3gc

Parent .md_W9gc

this .md_W4gc

Parent have double gutter

this .md_W5gc

.md_W3gc

Similar mix with row__item:

Parent .md_W9gc

this .md_W3gc

Parent .md_W9gc

this .md_W4gc

Parent without double gutter

this .md_W5gc

.md_W3gc

Markup: ../examples/css_lib-helpers/row/row__col.html
<div class="row">
	<div class="row__col row test-row sm_W4gc md_W9gc">
		<div class="row__col sm_W2gc md_W3gc">
			<h3>Parent .md_W9gc</h3>
			<p>this .md_W3gc</p>
		</div>
		<div class="row__col sm_W2gc md_W4gc">
			<h3>Parent .md_W9gc</h3>
			<p>this .md_W4gc</p>
		</div>
		<div class="row__col sm_W2gc md_W5gc">
			<h3>Parent have double gutter</h3>
			<p>this .md_W5gc</p>
		</div>
	</div>
	<div class="row__col sm_W2gc md_W3gc">
		<h3>.md_W3gc</h3>
	</div>
</div>
<p><b>Similar mix with row__item:</b></p>
<div class="row -Mx0">
	<div class="row__item row -Mx0 test-row sm_W4gc md_W9gc">
		<div class="row__col sm_W2gc md_W3gc">
			<h3>Parent .md_W9gc</h3>
			<p>this .md_W3gc</p>
		</div>
		<div class="row__col sm_W2gc md_W4gc">
			<h3>Parent .md_W9gc</h3>
			<p>this .md_W4gc</p>
		</div>
		<div class="row__col sm_W2gc md_W5gc">
			<h3>Parent without double gutter</h3>
			<p>this .md_W5gc</p>
		</div>
	</div>
	<div class="row__col sm_W2gc md_W3gc">
		<h3>.md_W3gc</h3>
	</div>
</div>
Source: ../packages/core/src/sass/css/helpers/row.scss, line 23

4.1.4.2 #css_lib.helpers.row.row__item row__item

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

Element for creating parts of the layout. By default, it stretches across the width of the content.

The sizes and offsets are set with help of utilities.

Like a row__col, an element contains formulas for calculating width and offset. But --ml-gsfd here is equal 0px.

Example

Элемент 0

элемент без отступов

Элемент 1

с внутренними отступами

Элемент 2

элемент без отступов

Последний элемент

с внешним отступом

Markup: ../examples/css_lib-helpers/row/row__item.html
<div class="row -Mx0">
	<div class="row__item">
		<h3>Элемент 0</h3>
		<p>элемент без отступов</p>
	</div>
	<div class="row__item test-content">
		<h3>Элемент 1</h3>
		<p>с внутренними отступами</p>
	</div>
	<div class="row__item sm_W2gc md_W2gc">
		<h3>Элемент 2</h3>
		<p>элемент без отступов</p>
	</div>
	<div class="row__item Ml1gg">
		<h3>Последний элемент</h3>
		<p>с внешним отступом</p>
	</div>
</div>
Source: ../packages/core/src/sass/css/helpers/row.scss, line 47

4.1.5 #css_lib.helpers.wrapper Wrapper

Toggle full screen Open in new window Toggle example guides Toggle HTML markup

The helper-container for the main content of the page. The maximum width is set in the settings. The default is 1200px.

The container has sides padding that equal to gutters so that the content does not stick to sides on small screens. On wide screens the container is centered.

Example

Simple text

Some content

Markup: ../examples/css_lib-helpers/wrapper/wrapper.html
<div class="wrapper">
	<h1>Simple text</h1>
	<p>Some content</p>
</div>
Source: ../packages/core/src/sass/css/helpers/wrapper.scss, line 3

4.2 #css_lib.styles Basic styles

Styles like reset and normalize

Source: content/main.css, line 1663

4.2.1 #css_lib.styles.css_vars CSS variables

Global CSS custom properties which used in mlut.

Parameters:
  • --ml-gg
    grid gutter.
    Defaults to: 0.75rem
  • --ml-gscc
    number of columns in the grid system. Sets by $gs-columns. Available only with $legacy-grid-system flag enabled
    Defaults to: 12
Source: ../packages/core/src/sass/css/styles/variables.scss, line 3

4.2.2 #css_lib.styles.generic Generic

Generic CSS that contains box-sizing, reset, browser bugs fixes etc. You can configure it with settings.

Source: ../packages/core/src/sass/css/styles/generic.scss, line 5