Skip to content

Instantly share code, notes, and snippets.

@erikflowers
erikflowers / gist:6247215
Created August 16, 2013 04:01
When using only mixins to make the columns, without a mixin at the mobile base level, the div doesn't have the styles that it would when used in HTML: position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px;
.left {
// What goes here?
@media(min-width: @screen-tablet) {
.make-sm-column(6);
}
@media(min-width: @screen-desktop) {
@erikflowers
erikflowers / Bootstrap-3-Smallest-Column-Mixin
Last active December 21, 2015 06:19
If you are building your Bootstrap 3 grid entirely using mixins, you need to declare a base column mixin for proper, full width columns at the smallest level. Otherwise, they lack the proper padding, min-height, and position as the same HTML markup column would have by default. This is used by adding .make-column(); at the base level before you …
// Generate a mixin for mobile full width columns, to maintain the same attributes
.make-column(@gutter: @grid-gutter-width) {
position: relative;
// Prevent columns from collapsing when empty
min-height: 1px;
// Inner gutter via padding
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
}
@erikflowers
erikflowers / fixed-screen-layered-background.less
Last active January 31, 2019 10:48
A Less mixin for layering 2 images in a background, and using "background-cover" so the bottom layer is always full size. Good for scrolling fixed backgrounds where you want a screen or other element on top. Here's a 2x2 pixel grid to get you started: http://www.helloerik.com/downloads/grid.png.zip See an example here:
.background-layers(@top, @bottom) {
background: url(@top), url(@bottom);
background-position: top center, top center;
background-attachment: fixed, fixed;
background-repeat: repeat, repeat;
-webkit-background-size: auto, cover;
-moz-background-size: auto, cover;
-o-background-size: auto, cover;
background-size: auto, cover;
}
@erikflowers
erikflowers / allmedia.sublime-snippet
Created September 2, 2013 21:54
Need to add some less for each bootstrap 3 media query size? Just type "allmedia" and tab, and here you go!
<snippet>
<content><![CDATA[
@media(min-width: @screen-tablet) {
$1
}
@media(min-width: @screen-desktop) {
$1
}
@media(min-width: @screen-lg-desktop) {
$1
@erikflowers
erikflowers / css text select highlight
Created September 26, 2013 05:57
CSS Text Select Highlight
// This is the mixin
.highlight(@backgroundColor, @textColor) {
::selection, -moz::selection {
background: @backgroundColor;
color: @textColor;
}
}
// This is how you use it
@erikflowers
erikflowers / gist:6710372
Created September 26, 2013 06:01
An easy way to include just super standard 1px text shadows. No frills.
.textShadowBlack(@shadow: 0 1px 0px rgba(0,0,0,1)) {
text-shadow: @shadow;
}
.textShadowWhite(@shadow: 0 1px 0px rgba(255,255,255,1)) {
text-shadow: @shadow;
}
@erikflowers
erikflowers / gist:6710391
Created September 26, 2013 06:03
Quick add no styles to a UL - either inline or block
.ul-inline-no-style() {
margin: 0px;
list-style: none;
.clearfix;
li {
float: left;
display: block;
}
}
$(document).ready stickyAside = ->
top = $(".sticky").offset().top
$(window).scroll ->
if $(this).scrollTop() > top - 40
$(".sticky").addClass "stick image"
else
$(".sticky").removeClass "stick image"
@erikflowers
erikflowers / gist:8545409
Created January 21, 2014 18:28
experiment in non-responsifying Bootstrap 3, for whatever reason.... :(
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
// Note: Deprecated @screen-xs and @screen-phone as of v3.0.1
@screen-xs: 480px;
@screen-xs-min: @screen-xs;
@screen-phone: @screen-xs-min;
// Small screen / tablet
.left {
text-align: center;
}
@media (min-width: 768px) {
.left {
text-align: left;
}
}
.center {
text-align: center;