Skip to content

Instantly share code, notes, and snippets.

@Alecto
Last active December 4, 2023 08:52
Show Gist options
  • Save Alecto/a60f8b246bad4fab349d52a213df1eae to your computer and use it in GitHub Desktop.
Save Alecto/a60f8b246bad4fab349d52a213df1eae to your computer and use it in GitHub Desktop.
mixins, миксины SCSS
// Reset margin, padding and list-style from a list.
@mixin unlist($m: 0, $p: 0) {
margin: $m;
padding: $p;
list-style: none;
}
// Single-line text with a three-dot at the end
@mixin text-shorten {
overflow: hidden;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
}
// Multiline text with a triple-dot at the end
@mixin block-shorten($fz: 1rem, $lh: 1.5, $h: 70px, $l: 3) {
display: -webkit-box;
overflow: hidden;
height: $h;
font-size: $fz;
line-height: $fz * $lh;
-webkit-box-orient: vertical;
-webkit-line-clamp: $l;
}
// Turn off the ability to select an item
@mixin unselectable {
user-select: none;
-webkit-touch-callout: none;
}
// Visually hidden element
@mixin visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
}
// Absolute positioning
@mixin abs-position($top: 0, $right: 0, $bottom: 0, $left: 0) {
position: absolute;
top: $top;
right: $right;
bottom: $bottom;
left: $left;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment