barebones/assets/sass/config/_mixins.scss

84 lines
1.2 KiB
SCSS
Raw Normal View History

2014-08-20 19:18:16 +02:00
/*
* Media query to respond to a minimum size (mobile first)
*/
2014-06-20 16:59:08 +02:00
@mixin resp-min($size) {
2015-10-14 13:35:18 +02:00
@media screen and (min-width: $size) {
@content;
}
2014-06-20 16:59:08 +02:00
}
2014-08-20 19:18:16 +02:00
/*
* Media query to respond to a maximum size
*/
2014-06-20 16:59:08 +02:00
@mixin resp-max($size) {
2015-10-14 13:35:18 +02:00
@media screen and (max-width: $size) {
@content;
}
2014-01-30 12:20:51 +01:00
}
2014-08-20 19:18:16 +02:00
/*
* Output font size in px/rem
*/
2014-02-03 23:10:54 +01:00
@mixin font-size($px) {
2015-10-14 13:35:18 +02:00
font-size: $px + px;
font-size: #{$px / 16}rem;
2014-05-09 11:00:52 +02:00
}
2014-08-20 19:18:16 +02:00
/*
* Placeholder mixin for <input>
*/
2015-10-14 13:35:18 +02:00
@mixin placeholder {
$placeholders: ":-webkit-input" ":-moz" "-moz" "-ms-input";
@each $placeholder in $placeholders {
&:#{$placeholder}-placeholder {
@content;
}
2014-09-05 16:36:38 +02:00
}
2014-06-03 15:32:07 +02:00
}
2015-04-01 18:32:10 +02:00
/**
* Clearfix
*/
2015-10-14 13:35:18 +02:00
@mixin clearfix {
&:before,
&:after{
content: " ";
display: table;
}
&:after{
clear: both;
}
2015-07-31 16:46:02 +02:00
}
2017-03-30 16:18:58 +02:00
/**
* Positioning
*/
@mixin center($horizontal: true, $vertical: true) {
position: absolute;
@if ($horizontal and $vertical) {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@else if ($horizontal) {
left: 50%;
2017-03-30 16:20:35 +02:00
transform: translateX(-50%);
2017-03-30 16:18:58 +02:00
}
@else if ($vertical) {
top: 50%;
2017-03-30 16:20:35 +02:00
transform: translateY(-50%);
2017-03-30 16:18:58 +02:00
}
}