Simple Sass Mixin for Width and Height
How do I make an simple sass mixin for width and height?
DRY typing the same values for width and height. Instead of typing width:200px; height:200px;, just type @include wh(150px);. What is a simple sass mixin for width and height? How do you make a simple sass mixin for width and height? This script and codes were developed by Ricardo Zea on 28 September 2022, Wednesday.
Simple Sass Mixin for Width and Height - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Simple Sass Mixin for Width and Height </title> <link rel='stylesheet prefetch' href='css/https___s3_us_west_2_amaz.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import "compass/css3";
@mixin size($width, $height: $width) { width: $width; height: $height;
}
.square { @include size(200px); }
/*=======================================*/
/*Styling stuff - Not needed for demo*/
h1 { }
h2 { margin-bottom:10px; }
h2:first-of-type { margin-top:0; }
.components-demo { display:flex; align-items:start; justify-content:space-around; width:60%; margin:auto; }
pre { margin: 0; }
.code { text-align: left; }
.square { background:linear-gradient($g, darken($g,10%)); border-radius:3px; box-shadow:inset 0 0 0 10px rgba(black,.05), 0 2px 5px rgba(black,.5); }
time { font-size: 11px; color:rgba(white,.1); }
.new-window { position: relative; padding-right: 16px; &:after { content:''; display: block; width: 14px; height: 12px; position: absolute; top: 10%; right: 0; background: url(https://i.stack.imgur.com/3H2PQ.png) no-repeat; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>Sass mixin for same Width and Height</h1>
<p>Instead of typing <code>width:200px; height:200px;</code> just type <code>@include size(200px);</code> or <code>@include size(20px,35px);</code></p>
<hr>
<h1>Demo</h1>
<div class="components-demo"> <div class="square"></div> <div class="code"> <h2>Mixin:</h2> <pre>@mixin size($width, $height: $width) { width: $width; height: $height;
}</pre> <h2>HTML:</h2> <code> <div class="square"></div> </code> <h2>Usage:</h2> <code>.square { @include size(200px); }</code> <h2>Compiles to:</h2> <pre>.square { width: 200px; height: 200px;
} </pre> </div>
</div>
<hr>
<p>Created by <a href="http://ricardozea.me/" target="_blank">Ricardo Zea</a></p>
<time datetime="3-23-2014">Created on: March 23, 2014</time> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Simple Sass Mixin for Width and Height - Script Codes CSS Codes
@import "compass/css3";
@mixin size($width, $height: $width) { width: $width; height: $height;
}
.square { @include size(200px); }
/*=======================================*/
/*Styling stuff - Not needed for demo*/
h1 { }
h2 { margin-bottom:10px; }
h2:first-of-type { margin-top:0; }
.components-demo { display:flex; align-items:start; justify-content:space-around; width:60%; margin:auto; }
pre { margin: 0; }
.code { text-align: left; }
.square { background:linear-gradient($g, darken($g,10%)); border-radius:3px; box-shadow:inset 0 0 0 10px rgba(black,.05), 0 2px 5px rgba(black,.5); }
time { font-size: 11px; color:rgba(white,.1); }
.new-window { position: relative; padding-right: 16px; &:after { content:''; display: block; width: 14px; height: 12px; position: absolute; top: 10%; right: 0; background: url(https://i.stack.imgur.com/3H2PQ.png) no-repeat; }
}
Simple Sass Mixin for Width and Height - Script Codes JS Codes
//Add a title to the links that open in a new tab/window
$("a[target='_blank']").attr({title:'Opens in a new tab/window'}).addClass('new-window');
Developer | Ricardo Zea |
Username | ricardozea |
Uploaded | September 28, 2022 |
Rating | 3.5 |
Size | 4,523 Kb |
Views | 26,312 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Shapes with Sass | 5,726 Kb |
Sass Mixin for Links | 3,743 Kb |
Sass mixin for Inside Borders | 17,268 Kb |
CSS Blinking Text Cursor | 3,294 Kb |
Line-On-Sides Headers | 2,259 Kb |
03 - Custom CSS Grid - Floats | 5,018 Kb |
CSS Triangles and Arrows | 4,360 Kb |
Simple aqua button with CSS | 5,106 Kb |
Responsive Table CSS | 7,571 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Display properties | Hamzaerbay | 1,886 Kb |
Pictos font library from CodePen | Jstam | 3,790 Kb |
My Interests | Anshusaxenaarora | 2,015 Kb |
Get third wednesday | Wojtek1150 | 2,691 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
Kut D3 | Jellevrswk | 3,687 Kb |
Dribbble Template | ExtremelyGinger | 2,204 Kb |
Glowing Pulse Form | Jackrugile | 2,542 Kb |
E-mail Template | SoloMDFK | 4,871 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!