1
0
mirror of https://github.com/Chalarangelo/mini.css.git synced 2025-01-17 21:08:13 +01:00

Half the documentation for utility module

This commit is contained in:
Angelos Chalaris 2016-12-11 14:24:59 +02:00
parent ebc771b72a
commit a0bc3e810c
7 changed files with 218 additions and 60 deletions

55
dist/mini-default.css vendored
View File

@ -1267,15 +1267,47 @@ ul.breadcrumbs {
ul.breadcrumbs li:last-child:after {
border: 0; }
.close {
display: inline-block;
width: 0.75em;
height: 0.75em;
position: relative;
border-radius: 1em;
font-size: 32px;
text-overflow: clip;
background: rgba(224, 224, 224, 0);
vertical-align: top;
cursor: pointer;
-webkit-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s; }
.close:hover, .close:active, .close:focus {
background: #e0e0e0; }
.close:before, .close:after {
display: inline-block;
width: 0.45em;
height: 0.1em;
position: absolute;
content: "";
top: 0.33em;
left: 0.155em;
text-overflow: clip;
background: #212121; }
.close:before {
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg); }
.close:after {
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg); }
.clearfix:before, .clearfix:after {
content: ' ';
display: table;
clear: both; }
content: ' ' !important;
display: table !important;
clear: both !important; }
.center-block {
display: block;
margin-left: auto;
margin-right: auto; }
display: block !important;
margin-left: auto !important;
margin-right: auto !important; }
button.primary, [type="button"].primary, [type="submit"].primary,
[type="reset"].primary, .button.primary {
@ -1447,9 +1479,18 @@ progress.nano {
.circular {
border-radius: 50% !important; }
.no-shadow {
.shadow-none {
box-shadow: none !important; }
.shadow-small {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.15) !important; }
.shadow-medium {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.15) !important; }
.shadow-large {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 2px 3px rgba(0, 0, 0, 0.15) !important; }
.float-left {
float: left !important; }

File diff suppressed because one or more lines are too long

View File

@ -628,3 +628,6 @@
## 20161211
- Created `utility.html`, started documentation.
- Implemented mixins for responsive `padding` and `margin` in `utility`.
- Implemented new `close` icon/button in `utility`.
- Documented visibility helpers, floats etc., borders and shadows for `utility`.

View File

@ -81,7 +81,14 @@
<p><span class="bordered">Generic border (using black outline and opacity of 0.25)</span>, <span class="bordered rounded">Radial border style 1</span> &amp; <span class="bordered circular">&nbsp;2 </span>.</p>
<ul class="breadcrumbs"><li><a href="#">These</a></li><li><a href="#">is</a></li><li><a href="#">what</a></li><li><a href="#">breadcrumbs</a></li><li><a href="#">look</a></li><li><span>like</span></li></ul>
<p>You can also use the <code>.hidden</code> class to hide any element you want or the <code>.visually-hidden</code> class for elements that need to be invisible to users but exist in the accessibility tree, set <code>float</code>s to left or right using the <code>.float-left</code> and <code>.float-right</code> classes or clear <code>float</code>s using the <code>.clearfix</code> class, which implements the <a href="http://nicolasgallagher.com/micro-clearfix-hack/">micro clearfix</a> by Nicolas Gallagher. Finally, use the <code>.center-block</code> class to make an element center and display as a block.</p><br>
<p>Lorem ipsum dolor sit amet ... <span class="close"></span></p>
<span class="bordered rounded shadow-small">Very stylish element</span>
Do:
</div></main>
<!-- End of page content-->
<footer><strong>mini.css</strong> was designed and built 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>

View File

@ -119,33 +119,27 @@
<div class="col-sm">
<div class="card fluid">
<div class="section">
<h2>Visiblity helpers</h2>
<h2>Visibility helpers</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<!-- sample -->
</div>
<div class="col-sm-12 col-sm-first col-md-8 col-md-normal">
<p></p>
<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></pre>
<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></li>
<li>Both classes utilize <code><span class="fore-secondary">!important</span></code> declarations, so be careful when and how to use them.</li>
<li></li>
</ul>
<hr>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4">
<pre><!-- do code --></pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;</p>
</div>
<div class="col-sm-12 col-md-6 col-sm-last col-md-normal col-lg-4 col-lg-last">
<pre><!-- don't code --></pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;</p>
<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>
@ -159,30 +153,25 @@
<h2>Floats, centering &amp; clearfix</h2>
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<!-- sample -->
</div>
<div class="col-sm-12 col-sm-first col-md-8 col-md-normal">
<p></p>
<div class="col-sm-12 col-sm-first">
<p>You can easily make content float left or right, using the <code>.float-left</code> and <code>.float-right</code> classes. Clear all floats, using the <code>.clearfix</code> class, based on the <a href="http://nicolasgallagher.com/micro-clearfix-hack/">micro clearfix</a> by Nicolas Gallagher. Finally, use the <code>.center-block</code> class to make an element center and display as a block.</p>
<h3>Sample code</h3>
<pre></pre>
<pre>&lt;span class=&quot;float-left&quot;&gt;Float left&lt;/span&gt;
&lt;span class=&quot;float-right&quot;&gt;Float right&lt;/span&gt;
&lt;span class=&quot;clearfix&quot;&gt;Clearfix&lt;/span&gt;
&lt;span class=&quot;center-block&quot;&gt;Center block&lt;/span&gt;</pre>
</div>
</div>
<div class="section">
<h3>Notes</h3>
<ul>
<li></li>
<li></li>
<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>
</ul>
<hr>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-4">
<pre><!-- do code --></pre>
<p class="do"><mark class="tertiary">Do:</mark>&nbsp;</p>
</div>
<div class="col-sm-12 col-md-6 col-sm-last col-md-normal col-lg-4 col-lg-last">
<pre><!-- don't code --></pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;</p>
<div class="col-sm-12">
<pre>&lt;span class=&quot;float-left float-right&quot;&gt;Avoid this&lt;/span&gt;</pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;Avoid combining any two of the above classes (except if you use <code>.clearfix</code> to temporarily clear a float or something similar), as they might overwrite each other and cause unexpected behavior.</p>
</div>
</div>
</div>
@ -197,29 +186,44 @@
</div>
<div class="section row">
<div class="col-sm-12 col-sm-last col-md-4 col-md-normal">
<!-- sample -->
<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></p>
<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></pre>
<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></li>
<li></li>
<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 col-lg-4">
<pre><!-- do code --></pre>
<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;</p>
</div>
<div class="col-sm-12 col-md-6 col-sm-last col-md-normal col-lg-4 col-lg-last">
<pre><!-- don't code --></pre>
<p class="dont"><mark class="secondary">Don't:</mark>&nbsp;</p>
<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>

View File

@ -473,13 +473,26 @@ $breadcrumbs-border-style: 0; // Border style for breadcrumbs
$breadcrumbs-border-radius: 4px; // Border radius for breadcrumbs
$breadcrumbs-box-shadow: // Box shadow for breadcrumbs
0 1px 3px rgba(0,0,0,0.1),0 1px 2px rgba(0,0,0,0.15);
$close-icon-name: 'close'; // Class name for close icon
$close-icon-size: 32px; // Size of the close icon
$close-icon-back-color: #e0e0e0; // Background color for the close icon
$close-icon-fore-color: #212121; // Foreground color for the close icon
$border-generic-name: 'bordered'; // Class name for generic border style
$border-radial-style1-name: 'rounded'; // Class name for radial border style 1
$border-radial-style1-radius: 2px; // Border radius for radial border style 1
$border-radial-style2-name: 'circular'; // Class name for radial border style 2
$border-radial-style2-radius: 50%; // Border radius for radial border style 2
$box-shadow-none-name: 'no-shadow'; // Class name for generic no-box-shadow
$box-shadow-none-value: none; // Box shadow value for generic no-box-shadow
$box-shadow-style1-name: 'shadow-none'; // Class name for generic box-shadow style 1
$box-shadow-style1-value: none; // Box shadow value for generic box-shadow style 1
$box-shadow-style2-name: 'shadow-small'; // Class name for generic box-shadow style 2
$box-shadow-style2-value: // Box shadow value for generic box-shadow style 2
0 1px 2px rgba(0,0,0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.15);
$box-shadow-style3-name: 'shadow-medium'; // Class name for generic box-shadow style 3
$box-shadow-style3-value: // Box shadow value for generic box-shadow style 3
0 1px 3px rgba(0,0,0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.15);
$box-shadow-style4-name: 'shadow-large'; // Class name for generic box-shadow style 4
$box-shadow-style4-value: // Box shadow value for generic box-shadow style 4
0 2px 4px rgba(0,0,0, 0.1), 0 2px 3px rgba(0, 0, 0, 0.15);
$float-prefix: 'float'; // Prefix for float classes
$clearfix-name: 'clearfix'; // Class name for clearfix
$center-block-name: 'center-block'; // Class name for center block
@ -539,5 +552,8 @@ $center-block-name: 'center-block'; // Class name for center block
@include make-border-generic ($border-generic-name);
@include make-border-radial-style ($border-radial-style1-name, $border-radial-style1-radius);
@include make-border-radial-style ($border-radial-style2-name, $border-radial-style2-radius);
@include make-box-shadow-generic ($box-shadow-none-name, $box-shadow-none-value);
@include make-box-shadow-generic ($box-shadow-style1-name, $box-shadow-style1-value);
@include make-box-shadow-generic ($box-shadow-style2-name, $box-shadow-style2-value);
@include make-box-shadow-generic ($box-shadow-style3-name, $box-shadow-style3-value);
@include make-box-shadow-generic ($box-shadow-style4-name, $box-shadow-style4-value);
@include make-floats ($float-prefix);

View File

@ -87,19 +87,56 @@ ul.#{$breadcrumbs-name} {
}
}
}
// Clearfix
.#{$clearfix-name} {
// Close icon
.#{$close-icon-name}{
display: inline-block;
width: 0.75em;
height: 0.75em;
position: relative;
border-radius: 1em;
font-size: $close-icon-size;
text-overflow: clip;
background: rgba($close-icon-back-color,0);
vertical-align: top;
cursor: pointer;
-webkit-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
&:hover, &:active, &:focus {
background: rgba($close-icon-back-color,1);
}
&:before, &:after {
content: ' ';
display: table;
clear: both;
display: inline-block;
width: 0.45em;
height: 0.1em;
position: absolute;
content: "";
top: 0.33em;
left: 0.155em;
text-overflow: clip;
background: $close-icon-fore-color;
}
&:before {
-webkit-transform: rotateZ(45deg);
transform: rotateZ(45deg);
}
&:after {
-webkit-transform: rotateZ(-45deg);
transform: rotateZ(-45deg);
}
}
// Center block
// Clearfix. ATTENTION: Uses !important.
.#{$clearfix-name} {
&:before, &:after {
content: ' ' !important;
display: table !important;
clear: both !important;
}
}
// Center block. ATTENTION: Uses !important.
.#{$center-block-name} {
display: block;
margin-left: auto;
margin-right: auto;
display: block !important;
margin-left: auto !important;
margin-right: auto !important;
}
// Generic border mixin. ATTENTION: Uses !important.
// Variables:
@ -127,6 +164,56 @@ ul.#{$breadcrumbs-name} {
box-shadow: $box-shadow-value !important;
}
}
// Responsive margin mixin. ATTENTION: Uses !important.
// Variables:
// - $margin-name : The name of the class used for the responsive margin.
// - $margin-medium-breakpoint : Medium screen breakpoint for the responsive margin.
// - $margin-large-breakpoint : Large screen breakpoint for the responsive margin.
// - $margin-small-value : Responsive margin value for smaller screens.
// - $margin-medium-value : Responsive margin value for medium screens.
// - $margin-large-value : Responsive margin value for large screens.
@mixin make-margin-responsive ($margin-name, $margin-medium-breakpoint,
$margin-large-breakpoint, $margin-small-value, $margin-medium-value,
$margin-large-value) {
.#{$margin-name} {
margin: $margin-small-value !important;
}
@media (min-width: #{$margin-medium-breakpoint}) {
.#{$margin-name} {
margin: $margin-medium-value !important;
}
}
@media (min-width: #{$margin-large-breakpoint}) {
.#{$margin-name} {
margin: $margin-large-value !important;
}
}
}
// Responsive padding mixin. ATTENTION: Uses !important.
// Variables:
// - $padding-name : The name of the class used for the responsive padding.
// - $padding-medium-breakpoint : Medium screen breakpoint for the responsive padding.
// - $padding-large-breakpoint : Large screen breakpoint for the responsive padding.
// - $padding-small-value : Responsive padding value for smaller screens.
// - $padding-medium-value : Responsive padding value for medium screens.
// - $padding-large-value : Responsive padding value for large screens.
@mixin make-padding-responsive ($padding-name, $padding-medium-breakpoint,
$padding-large-breakpoint, $padding-small-value, $padding-medium-value,
$padding-large-value) {
.#{$padding-name} {
padding: $padding-small-value !important;
}
@media (min-width: #{$padding-medium-breakpoint}) {
.#{$padding-name} {
padding: $padding-medium-value !important;
}
}
@media (min-width: #{$padding-large-breakpoint}) {
.#{$padding-name} {
padding: $padding-large-value !important;
}
}
}
// Floats mixin. ATTENTION: Uses !important.
// NOTE: This mixin might be obsolete and not play well with others.
// Variables: