1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-24 10:16:16 +01:00
blog/_src/_assets/styl/_kremalicious/mixins.styl

266 lines
4.8 KiB
Stylus
Raw Normal View History

2014-07-12 02:00:18 +02:00
//
// kremalicious3
// --------------
// Mixins
//
// Micro Clearfix
/////////////////////////////////////
clearfix()
2014-07-12 21:22:47 +02:00
&:before,
2014-07-12 02:00:18 +02:00
&:after
2014-07-12 21:22:47 +02:00
content: " "
2014-07-12 02:00:18 +02:00
display: table
2014-07-12 21:22:47 +02:00
&:after
2014-07-12 02:00:18 +02:00
clear: both
.clearfix
clearfix()
// Floats
/////////////////////////////////////
alignright()
float: right
alignleft()
float: left
.alignright
alignright()
.alignleft
alignleft()
// Centering Blocks
/////////////////////////////////////
aligncenter()
display: block
margin-left: auto
margin-right: auto
.aligncenter
aligncenter()
// Centering Text
/////////////////////////////////////
textcenter()
2014-07-12 21:22:47 +02:00
text-align: center
2014-07-12 02:00:18 +02:00
.textcenter
2014-07-12 21:22:47 +02:00
textcenter()
2014-07-12 02:00:18 +02:00
// Toggling content
/////////////////////////////////////
// Hide from both screenreaders and browsers: h5bp.com/u
2014-07-12 21:22:47 +02:00
hide()
2014-07-12 02:00:18 +02:00
display: none !important
visibility: hidden
2014-07-12 21:22:47 +02:00
show()
2014-07-12 02:00:18 +02:00
display: block
visibility: visible
2014-07-12 21:22:47 +02:00
.hide
hide()
.show
show()
2014-07-12 02:00:18 +02:00
// Hide only visually, but have it available for screenreaders: h5bp.com/v
2014-07-12 21:22:47 +02:00
visuallyhidden()
2014-07-12 02:00:18 +02:00
border: 0
clip: rect(0 0 0 0)
height: 1px
margin: -1px
overflow: hidden
padding: 0
position: absolute
width: 1px
// Extends the .visuallyhidden class to allow the
// element to be focusable when navigated to via the keyboard: h5bp.com/p
&.focusable:active,
&.focusable:focus
clip: auto
height: auto
margin: 0
overflow: visible
position: static
width: auto
2014-07-12 21:22:47 +02:00
.visuallyhidden
visuallyhidden()
2014-07-12 02:00:18 +02:00
// Hide visually and from screenreaders, but maintain layout
.invisible
visibility: hidden
// CSS image replacement
/////////////////////////////////////
.ir,
.hide-text
2014-07-12 21:22:47 +02:00
font: 0/0 a
color: transparent
text-shadow: none
background-color: transparent
border: 0
2014-07-12 02:00:18 +02:00
// Text overflow
/////////////////////////////////////
2014-07-12 21:22:47 +02:00
ellipsis()
2014-07-12 02:00:18 +02:00
text-overflow: ellipsis
2014-07-12 21:22:47 +02:00
overflow: hidden
2014-07-12 02:00:18 +02:00
white-space: nowrap
2014-07-12 21:22:47 +02:00
.ellipsis
ellipsis()
// Default transition
/////////////////////////////////////
transition()
transition: all ease-in-out .15s
.transition
transition()
2014-07-12 02:00:18 +02:00
// Dashed Dividers
/////////////////////////////////////
.divider-top,
.divider-bottom
position: relative
&:before
2014-07-12 21:22:47 +02:00
content: ""
position: absolute
left: 0
2014-07-12 02:00:18 +02:00
height: 1px
.divider-top
2014-07-12 21:22:47 +02:00
border-top: 1px dashed #afc3cb
padding-top: 1em
2014-07-12 02:00:18 +02:00
2014-07-12 21:22:47 +02:00
&:after
content: ""
position: absolute
left: 0
2014-07-12 02:00:18 +02:00
height: 1px
2014-07-12 21:22:47 +02:00
top: 0
width: 100%
border-top: 1px dashed #fff
2014-07-12 02:00:18 +02:00
.divider-bottom
2014-07-12 21:22:47 +02:00
border-bottom: 1px dashed #afc3cb
padding-bottom: 1em
2014-07-12 02:00:18 +02:00
2014-07-12 21:22:47 +02:00
&:before
bottom: -2px
width: 100%
border-bottom: 1px dashed #fff
2014-07-12 02:00:18 +02:00
// Heading band
/////////////////////////////////////
.heading-band
2014-07-12 21:22:47 +02:00
display: inline-block
clear: both
background: rgba(255,255,255,.55)
padding: ($spacer/2) $spacer ($spacer/2) 100%
2014-07-12 21:22:47 +02:00
margin-left: -100%
2014-07-12 02:00:18 +02:00
2016-06-09 19:25:01 +02:00
2014-07-12 02:00:18 +02:00
// Lead paragraph
/////////////////////////////////////
.lead
2014-07-12 21:22:47 +02:00
font-size: $font-size-large
line-height: ($spacer*1.15)
2014-07-12 02:00:18 +02:00
2016-06-09 19:25:01 +02:00
// Layout breakout
/////////////////////////////////////
breakoutviewport()
margin-left: calc(-50vw + 50%)
margin-right: calc(-50vw + 50%)
@media $screen-md
breakoutviewport--base()
breakoutviewport--base()
margin-left: -($gutter-space * 4)
margin-right: -($gutter-space * 4)
breakoutviewport--full()
margin-left: calc(-50vw + 50%)
margin-right: calc(-50vw + 50%)
.breakoutviewport
breakoutviewport()
.breakoutviewport--base
breakoutviewport--base()
.breakoutviewport--full
breakoutviewport--full()
2014-07-12 02:00:18 +02:00
// Button sizing
/////////////////////////////////////
button-size(padding-vertical, padding-horizontal, font-size, line-height, border-radius)
padding: padding-vertical padding-horizontal
font-size: font-size
line-height: line-height
border-radius: border-radius
// Form control sizing
/////////////////////////////////////
2016-04-16 21:17:09 +02:00
input-size(padding-vertical, padding-horizontal, font-size, line-height, border-radius)
2014-07-12 02:00:18 +02:00
padding: padding-vertical padding-horizontal
font-size: font-size
line-height: line-height
border-radius: border-radius
input[type="search"]&
background-size: font-size
background-position: padding-vertical center
padding-left: (padding-vertical*4)
select&
line-height: input-height
textarea&,
select[multiple]&
2014-07-12 21:22:47 +02:00
height: auto
2015-08-09 18:11:26 +02:00
// Placeholder text
/////////////////////////////////////
placeholder($color = $input-color-placeholder)
&::-moz-placeholder // Firefox
color $color
opacity 1 // Override Firefox's unusual default opacity; See https//github.com/twbs/bootstrap/pull/11526
&:-ms-input-placeholder // Internet Explorer 10+
color $color
&::-webkit-input-placeholder // Safari and Chrome
color $color