Sass Mixin for Links
How do I make an sass mixin for links?
A simple mixin that "forces" you to declare the 4 states of links: - :link, :visited, :hover and :active.. What is a sass mixin for links? How do you make a sass mixin for links? This script and codes were developed by Ricardo Zea on 28 September 2022, Wednesday.
Sass Mixin for Links - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Sass Mixin for Links</title> <link rel='stylesheet prefetch' href='css/https___s3_us_west_2_amaz.css'>
<link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/9988/highlight.min-9.1.0.css'>
<link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/9988/highlight-theme-monokai-sublime.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Sass Mixin for Links</h1>
<a href="#">This is a link</a>
<hr />
<p>The idea behind this mixin is that no defaults are declared in the arguments so that we are “forced” in a friendly way to declare all 4 states of our links.</p>
<p>The <code>:focus</code> and <code>:active</code> pseudo-classes are usually declared together. Feel free to separate them if you want to do so.</p>
<p>One note about this mixin, is that it can be applied to any HTML element, not only links.</p>
<hr />
<h2>Mixin:</h2>
<pre><code class="css">@mixin links ($link, $visited, $hover, $active) { & { color: $link; &:visited { color: $visited; } &:hover { color: $hover; } &:active, &:focus { color: $active; } }
}
</code></pre>
<h2>Usage:</h2>
<pre><code class="css">a { @include links(orange, blue, yellow, teal);
}</code></pre>
<h2>Compiles to:</h2>
<pre><code class="css">a { color: orange;
}
a:visited { color: blue;
}
a:hover { color: yellow;
}
a:active, a:focus { color: teal;
}</code></pre> <script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/9988/highlight.min-9.1.0.js'></script> <script src="js/index.js"></script>
</body>
</html>
Sass Mixin for Links - Script Codes CSS Codes
a { color: orange;
}
a:visited { color: blue;
}
a:hover { color: yellow;
}
a:active, a:focus { color: teal;
}
a { padding: 4px 10px; font-size: 20px; background: #444;
}
pre, code, p { text-align: left;
}
code { background: none; box-shadow: none; font-size: 18px;
}
h2 { text-align: left;
}
* { font-weight: normal !important;
}
Sass Mixin for Links - Script Codes JS Codes
/*Highlight.JS
https://highlightjs.org/
*/
hljs.initHighlightingOnLoad();
![Sass Mixin for Links - Script Codes](http://shots.codepen.io/ricardozea/pen/wMyZQe-512.jpg)
Developer | Ricardo Zea |
Username | ricardozea |
Uploaded | September 28, 2022 |
Rating | 4 |
Size | 3,743 Kb |
Views | 14,168 |
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 |
Simple Sass Mixin for Width and Height | 4,523 Kb |
Line-On-Sides Headers | 2,259 Kb |
CSS Shapes with Sass | 5,726 Kb |
Simple aqua button with CSS | 5,106 Kb |
CSS Triangles and Arrows | 4,360 Kb |
Responsive Table CSS | 7,571 Kb |
CSS Blinking Text Cursor | 3,294 Kb |
Sass mixin for Inside Borders | 17,268 Kb |
03 - Custom CSS Grid - Floats | 5,018 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 |
Polo, the flying squirrel | Agbales | 2,445 Kb |
CSS3 Form Page Design | Rssatnam | 3,613 Kb |
The Monty Hall Problem | Melatonind | 4,360 Kb |
My Interests | Anshusaxenaarora | 2,015 Kb |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Shopping List | Markmurray | 6,015 Kb |
Css or Czz.. | Judag | 4,111 Kb |
Canvas stripes | Adrianparr | 1,948 Kb |
A Pen by Huan Nghiem | Nightshade | 10,646 Kb |
A form arranged using automatic placement. | Vikasford | 2,103 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!