mini.css/docs/utility.html
2017-02-03 00:27:22 +02:00

349 lines
20 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.rawgit.com/Chalarangelo/mini.css/v2.1.0/dist/mini-default.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<title>mini.css - Utility</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="mini.css - Minimal, responsive, style-agnostic CSS framework">
<meta name="keywords" content="mini, mini.css, CSS, framework, minimal, responsive, style-agnostic, front-end, frontend, Sass, module, utility, helper, classes, utilities ">
<meta name="author" content="Angelos Chalaris (chalarangelo)">
<meta property="og:title" content="mini.css - Minimal, responsive, style-agnostic CSS framework">
<meta property="og:type" content="website"/>
<meta property="og:description" content="mini.css is a tiny CSS framework designed to build quick, modern and responsive websites."/>
<meta property="og:image" content="page_thumb.PNG">
<meta property="og:url" content="https://chalarangelo.github.io/mini.css/">
<link rel="icon" type="image/png" href="favicon.png">
<style>
/* Classes and ids used in multiple pages - page top and utilities */
#header-logo {
display: inline; height: 28px; width: 28px; margin-top: 4px; background: #558b2f; border-radius: 1px;
padding: 4px;
}
#top-logo {
display: inline-block; height: 66px; width: 70px; margin: 64px auto -30px; border-radius: 1px;
background: #558b2f; padding: 8px; padding-top: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
#top-heading {
color: #f5f5f5; font-size: 2.4em; text-shadow: 0 1px 2px rgba(0,0,0,0.35); margin-bottom: -8px;
}
#top-version-tag {
padding: 4px 6px; font-size: 0.85em; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.box-centered { text-align: center; }
.box-colored { background: #0277bd; border-radius: 2px; padding: 14px; margin-bottom: 8px; min-height: 14px;}
.box-colored.red { background: #b71c1c; }
.box-centered > .card.fluid {
-webkit-box-pack: start;
-webkit-box-align: start;
-webkit-justify-content: flex-start;
justify-content: flex-start;
-webkit-align-self: auto;
align-self: auto;
}
[class^='col-'] .card.fluid { margin: 2px 0 20px; }
/* Local classes and ids for this page */
.fore-primary { color: #0d47a1; font-family: monospace, monospace; }
.fore-secondary { color: #b71c1c; font-family: monospace, monospace; }
.fore-tertiary { color: #1b5e20; font-family: monospace, monospace; }
.col-sm-12.col-sm-last.col-md-4.col-md-normal {
box-sizing: border-box;
border-right: 1px solid #bdbdbd;
}
@media (max-width: 767px){
.col-sm-12.col-sm-last.col-md-4.col-md-normal {
border: 0;
border-top: 1px solid #bdbdbd;
}
}
.box-colored.green { background: #1b5e20; }
.do {
border-top: 15px solid #689f38;
padding-top: 10px;
}
.dont {
border-top: 15px solid #e53935;
padding-top: 10px;
}
.box-colored {
color: #f5f5f5;
}
header.sticky a.button {
padding: 4px 6px; font-size: 0.95em;
}
</style>
</head>
<body>
<header>
<a href="index.html" class="logo"><img src="mini-logo.svg" id="header-logo">&nbsp;<span style="vertical-align: top; position: relative; top:-12px;"><span style="font-size: 1.35em;">m</span>ini<span style="font-size:0.65em; color: #558b2f;">.css</span></span></a><div style="display: inline; overflow: auto;">
<a href="index.html" class="button">Introduction</a>
<a href="modules.html" class="button">Modules</a>
<a href="flavors.html" class="button">Flavors</a>
<a href="customization.html" class="button">Customization</a>
<a href="quick_reference.html" class="button">Quick Reference</a>
<a href="https://github.com/Chalarangelo/mini.css" class="button"><i class="fa fa-github" aria-hidden="true" style="font-size: 1.4em; position: relative; bottom: -2px; margin-right: 2px;"></i>&nbsp;Github</a>
</div>
</header>
<header class="sticky" style="box-shadow: 0 2px 4px rgba(0,0,0, 0.18), 0 2px 3px rgba(0, 0, 0, 0.26); height: 36px;">
<a href="core.html" class="button">Core</a>
<a href="grid.html" class="button">Grid</a>
<a href="navigation.html" class="button">Navigation</a>
<a href="input_control.html" class="button">Input Control</a>
<a href="table.html" class="button">Table</a>
<a href="card.html" class="button">Card</a>
<a href="tab.html" class="button">Tab</a>
<a href="contextual.html" class="button">Contextual</a>
<a href="progress.html" class="button">Progress</a>
<a href="utility.html" class="button">Utility</a>
</div>
</header>
<!-- Insert your page content here-->
<main><div class="container">
<div class="row" style="padding-top: 40px;">
<div class="col-sm">
<h1>Utility</h1>
<p>The <strong>utility</strong> module contains all the utilities and helper classes that you might want when designing a website or application. They solve common design problems efficiently and provide you with generic rules you can easily apply everywhere.</p>
<p><small>All examples showcased refer to the mini-default flavor, some class names and styles might differ based on the flavor you're using.</small></p>
<ul class="breadcrumbs"><li><a href="index.html">Home</a></li><li><a href="modules.html">Modules</a></li><li>Utility</li></ul>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Quick overview</h2>
<p>Every website or app has different needs and no UI toolkit can predict them all. The <strong>utility</strong> module addresses this issue by providing you with a handful of utility and helper classes to make common, repetitive declarations easier. These classes include, but are not limited to, generic border styling and shadows, floats, centering and clearfix classes, some responsive sizing and spacing utilities and a few other things, like a close icon, breadcrumbs styling and visiblity helpers for screen readers.</p><br>
</div>
<div class="section">
<h2>Quick start</h2>
<p>To use the <strong>utility</strong> module, simply include the link to the flavor you are using and start writing your HTML page as usual. One suggestion we will make is to add the following line inside your HTML page's <code>&lt;head&gt;</code> to utilize the viewport meta tag:</p><br>
<pre>&lt;<span class="fore-tertiary">meta</span> <span class="fore-secondary">name</span>=<span class="fore-primary">&quot;viewport&quot;</span> <span class="fore-secondary">content</span>=<span class="fore-primary">&quot;width=device-width, initial-scale=1&quot;</span>&gt;</pre><br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Visibility helpers</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-first">
<p>You can hide content for all your users, using the default <code><span class="fore-secondary">hidden</span></code> attribute. However, we provide you with the <code>.hidden</code> class for the same purpose, as well as the <code>.visually-hidden</code> class which will make your content hidden, except for screen readers.</p>
<h3>Sample code</h3>
<pre>&lt;span class=&quot;hidden&quot;&gt;Hidden text&lt;/span&gt;
&lt;span class=&quot;visually-hidden&quot;&gt;Screen-reader-only text&lt;/span&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li>Both classes utilize <code><span class="fore-secondary">!important</span></code> declarations, so be careful when and how to use them.</li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12">
<pre>&lt;span class=&quot;hidden visually-hidden&quot;&gt;Not a good idea&lt;/span&gt;</pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;Avoid using both classes at the same time. Instead, use <code>.hidden</code> to hide content for all users, <code>.visually-hidden</code> to hide it for non-screen-reader users or <code><span class="fore-secondary">aria-hidden</span>=<span class="fore-primary">&quot;true&quot;</span></code> to hide it for screen-reader-only users.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Generic borders &amp; shadows</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<div>
<br>
<p>This is a paragraph with a piece of <span class="bordered">bordered text</span>.</p>
<button class="bordered">Bordered button</button><button class="bordered primary">Bordered button</button><br>
<p><img src="http://placehold.it/200x200?text=rounded" class="rounded">&nbsp;&nbsp;<img src="http://placehold.it/200x200?text=circular" class="circular"></p><br>
<p><span class="shadow-none">No shadow</span>&nbsp;&nbsp;<span class="shadow-small">Small shadow</span>&nbsp;&nbsp;<span class="shadow-medium">Medium shadow</span>&nbsp;&nbsp;<span class="shadow-large">Large shadow</span></p><br>
</div>
</div>
<div class="col-sm-12 col-sm-first col-md-8 col-md-normal">
<p>Use the <code>.bordered</code> class to apply a generic black border with 25% opacity to any element. Apart from that you can use the <code>.rounded</code> and <code>.circular</code> classes to create generic border radiuses. Finally, you can use the <code>.shadow-small</code>, <code>.shadow-medium</code> and <code>.shadow-large</code> to add a generic <code><span class="fore-secondary">box-shadow</span></code> to any element, as well as the <code>.shadow-none</code> class to remove it entirely.</p>
<h3>Sample code</h3>
<pre>&lt;span class=&quot;bordered&quot;&gt;Bordered&lt;/span&gt;
&lt;span class=&quot;rounded&quot;&gt;Rounded&lt;/span&gt;
&lt;span class=&quot;circular&quot;&gt;Circular&lt;/span&gt;
&lt;span class=&quot;shadow-none&quot;&gt;No shadow&lt;/span&gt;
&lt;span class=&quot;shadow-small&quot;&gt;Small shadow&lt;/span&gt;
&lt;span class=&quot;shadow-medium&quot;&gt;Medium shadow&lt;/span&gt;
&lt;span class=&quot;shadow-large&quot;&gt;Large shadow&lt;/span&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li>All of these classes utilize <code><span class="fore-secondary">!important</span></code> declarations, so be careful when and how to use them.</li>
<li>The <code>.bordered</code> class was originally created with elements such as buttons in mind, to allow users highlighting certain elements in their designs, without having to change any default styles.</li>
<li>All of the above classes can be used with most modern HTML elements.</li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12 col-md-6">
<pre>&lt;span class=&quot;bordered rounded shadow-small&quot;&gt;Stylized element&lt;/span&gt;</pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;You can combine a generic border with any border radius or shadow or even both.</p>
</div>
<div class="col-sm-12 col-md-6 col-sm-last col-md-normal">
<pre>&lt;span class=&quot;rounded circular&quot;&gt;Bad radius&lt;/span&gt;
<span class="fore-secondary">&lt;!-- or --&gt;</span>
&lt;span class=&quot;shadow-small shadow-large&quot;&gt;Bad shadow&lt;/span&gt;</pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;Avoid combining two classes of the same type (i.e. two radii or two shadow styles), as they might overwrite each other and cause unexpected behavior.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Responsive sizing &amp; spacing classes</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-first">
<p>Helper classes for the <code>padding</code> and <code>margin</code> attributes are provided in the form of <code>.responsive-margin</code> and <code>.responsive-padding</code> classes. Both of these classes are responsive, allowing you to collapse the spacing and size of elements on different displays to make better use of the device's viewport.</p>
<h3>Sample code</h3>
<pre>&lt;div class=&quot;responsive-padding&quot;&gt;Responsive padding&lt;/div&gt;
&lt;div class=&quot;responsive-margin&quot;&gt;Responsive margin&lt;/div&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li>If the default values of these classes are not suited to your needs, check out the <a href="customization.html">customization</a> page.</li>
<li>Both classes utilize <code><span class="fore-secondary">!important</span></code> declarations, so be careful when and how to use them.</li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12">
<pre>&lt;div class=&quot;responsive-padding responsive-margin&quot;&gt;Responsive padding and margin&lt;/div&gt;</pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;You can use both of these classes to make certain element adapt to changes. This could be especially useful for certain grid layouts.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Breadcrumbs</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<div>
<br>
<ul class="breadcrumbs">
<li><a href="#">Root</a></li>
<li><a href="#">Folder</a></li>
<li>File</li>
</ul>
<br>
</div>
</div>
<div class="col-sm-12 col-sm-first col-md-8 col-md-normal">
<p>Breadcrumbs are usually used to show the navigational hierarchy of pages or folders. To use them, simply create a <code>&lt;ul&gt;</code> element that implements the <code>.breadcrumbs</code> class. Inside this unordered list, add as many <code>&lt;li&gt;</code> elements as needed to show your hierarchy. You can add links to the list elements, as necessary.</p>
<h3>Sample code</h3>
<pre>&lt;ul class=&quot;breadcrumbs&quot;&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Root&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Folder&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;File&lt;/li&gt;
&lt;/ul&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li>The separators between breadcrumbs are added using some tricky CSS rules. Due to that, there might be a few browser versions or devices where you can see part of the seams between the element separators.</li>
<li>Breadcrumbs show a hierarchy, an ordered list. However, we do not use the <code>&lt;ol&gt;</code> element, as it might conflict with some custom styles we've seen people use.</li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12 col-md-6">
<pre>&lt;ol class=&quot;breadcrumbs&quot;&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Does&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Not&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Work&lt;/li&gt;
&lt;/ol&gt;</pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;The structure of the breadcrumb component prohibits the use of <code>&lt;ol&gt;</code> in place of the <code>&lt;ul&gt;</code> element.</p>
</div>
<div class="col-sm-12 col-md-6 col-sm-last col-md-normal">
<pre>&lt;ul class=&quot;breadcrumbs&quot;&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Root&lt;/a&gt;
&lt;ul class=&quot;breadcrumbs&quot;&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Folder&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;File&lt;/li&gt;
&lt;/ul&gt;</pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;Avoid nesting lists, breadcrumbs or a combination of the two inside the <code>.breadcrumbs</code> list, as this might cause unexpected behavior.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Close icon</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<div>
<br>
<p style="text-align:center;">&nbsp;&nbsp;<span class="close"></span>&nbsp;&nbsp;</p>
<br>
</div>
</div>
<div class="col-sm-12 col-sm-first col-md-8 col-md-normal">
<p>To create a close icon, simply add an element implementing the <code>.close</code> class.</p>
<h3>Sample code</h3>
<pre>&lt;span class=&quot;close&quot;&gt;&lt;/span&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li>The close icon behaves similar to a button when hovering over it or otherwise focusing or selecting it.</li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12 col-md-6">
<pre>&lt;div class=&quot;close&quot;&gt;&lt;/div&gt;</pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;You can use a handful of other HTML elements instead of the <code>&lt;span&gt;</code> element showcased in the example above, most commonly <code>&lt;div&gt;</code> elements.</p>
</div>
<div class="col-sm-12 col-md-6">
<pre>&lt;button class=&quot;close&quot;&gt;&lt;/button&gt;</pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;If you want your close icon to behave like a button (i.e. register as a button on screen readers and have the required logic attached to it), you can apply the <code>.close</code> class to a <code>&lt;button&gt;</code> element instead. You can even apply any of the button color variant classes.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="padding-bottom: 20px; padding-top:20px;">
<div class="col-sm">
<p>If you want to learn more about <strong>mini.css</strong>'s modules, go back to the <a href="modules.html">modules page</a> and choose another module to see its documentation.</p>
</div>
</div>
</div></main>
<!-- End of page content-->
<footer><strong>mini.css</strong> was designed and built with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://github.com/Chalarangelo">@Chalarangelo</a>. It is licensed under the <a href="https://github.com/Chalarangelo/mini.css/blob/master/LICENSE">MIT License</a>. You can view the project's source code on <a href="https://github.com/Chalarangelo/mini.css">Github</a>.</footer>
</body>
</html>