Created
January 26, 2014 11:17
-
-
Save shyamsalimkumar/8631271 to your computer and use it in GitHub Desktop.
Handy CSS http://tympanus.net/codrops/2012/10/25/kick-start-your-project-a-collection-of-handy-css-snippets/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.transform(@string) { | |
-webkit-transform: @string; | |
-moz-transform: @string; | |
-ms-transform: @string; | |
-o-transform: @string; | |
transform: @string; | |
} | |
.rotate(@deg) { | |
-webkit-transform: rotate(@deg); | |
-moz-transform: rotate(@deg); | |
-ms-transform: rotate(@deg); | |
-o-transform: rotate(@deg); | |
transform: rotate(@deg); | |
} | |
.scale(@factor) { | |
-webkit-transform: scale(@factor); | |
-moz-transform: scale(@factor); | |
-ms-transform: scale(@factor); | |
-o-transform: scale(@factor); | |
transform: scale(@factor); | |
} | |
.translate (@x, @y) { | |
-webkit-transform: translate(@x, @y); | |
-moz-transform: translate(@x, @y); | |
-ms-transform: translate(@x, @y); | |
-o-transform: translate(@x, @y); | |
transform: translate(@x, @y); | |
} | |
.transition(@string: all 0.3s ease-out) { | |
-webkit-transition: @string; | |
-moz-transition: @string; | |
-ms-transition: @string; | |
-o-transition: @string; | |
transition: @string; | |
} | |
.box-sizing(@value: border-box) { | |
-webkit-box-sizing: @value; | |
-moz-box-sizing: @value; | |
-box-sizing: @value; | |
} | |
.placement(@type, @top, @right, @bottom, @left) { | |
position: @type; | |
top: @top; | |
right: @right; | |
bottom: @bottom; | |
left: @left; | |
} | |
.font-size($pxValue){ | |
@remValue: (@pxValue / 10); | |
font-size: ~"@{pxValue}px"; | |
font-size: ~"@{remValue}rem"; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- SVG version of grayscale filter: desaturate.svg --> | |
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"> | |
<filter id="grayscale"> | |
<feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 | |
0.3333 0.3333 0.3333 0 0 | |
0.3333 0.3333 0.3333 0 0 | |
0 0 0 1 0"/> | |
</filter> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Shorthand classes */ | |
.float-left { | |
float: left; | |
} | |
.float-right { | |
float: right; | |
} | |
.hide { | |
display: none; | |
} | |
.show { | |
display: block; | |
} | |
/* Design-related snippets */ | |
.content { | |
font: 1em/1.4 Segoe, "Segoe UI", "Helvetica Neue", Arial, sans-serif; | |
} | |
.title { | |
font: 1.7em/1.2 Baskerville, "Baskerville old face", "Hoefler Text", Garamond, "Times New Roman", serif; | |
} | |
.code { | |
font: 0.8em/1.6 Monaco, Mono-Space, monospace; | |
} | |
.disabled { | |
pointer-events: none; | |
opacity: 0.5; | |
} | |
table tr:nth-child(even) { | |
/* Zebra pattern */ | |
background: rgba(0,0,0,0.1); | |
} | |
a { | |
text-decoration: none; | |
color: #08C; | |
transition: all 0.3s ease-out; | |
position: relative; | |
padding: .5em; | |
margin: -.5em; | |
} | |
a:hover { color: #0AF; } | |
/* Development-related snippets */ | |
*, *:before, *:after { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
.clearfix:before, | |
.clearfix:after { | |
content: " "; | |
display: table; | |
} | |
.clearfix:after { | |
clear: both; | |
} | |
/* IE6/7 support */ | |
.clearfix { | |
*zoom: 1; | |
} | |
.visuallyhidden { | |
position: absolute; | |
width: 1px; /* Setting this to 0 make it invisible for VoiceOver */ | |
height: 1px; /* Setting this to 0 make it invisible for VoiceOver */ | |
padding: 0; | |
margin: -1px; | |
border: 0; | |
clip: rect(0 0 0 0); | |
overflow: hidden; | |
} | |
.ir { | |
text-indent: 100%; | |
white-space: nowrap; | |
overflow: hidden; | |
} | |
.break { | |
-ms-word-break: break-all; | |
word-break: break-all; | |
word-break: break-word; | |
-webkit-hyphens: auto; | |
-moz-hyphens: auto; | |
hyphens: auto; | |
} | |
.ellipsis { | |
width: 250px; | |
white-space: nowrap; | |
overflow: hidden; | |
-ms-text-overflow: ellipsis; /* Required for IE8 */ | |
-o-text-overflow: ellipsis; /* Required for Opera */ | |
text-overflow: ellipsis; | |
} | |
pre { | |
white-space: pre-wrap; /* Chrome & Safari */ | |
white-space: -moz-pre-wrap; /* Mozilla since 1999 */ | |
white-space: -pre-wrap; /* Opera 4-6 */ | |
white-space: -o-pre-wrap; /* Opera 7 */ | |
word-wrap: break-word; /* Internet Explorer 5.5+ */ | |
} | |
/* Miscellaneous */ | |
@media print { | |
* { | |
background: none !important; | |
color: black !important; | |
box-shadow: none !important; | |
text-shadow: none !important; | |
/* Images, vectors and such */ | |
filter: Gray(); /* IE4-8: depreciated */ | |
filter: url('desaturate.svg#grayscale'); /* SVG version for IE10, Firefox, Safari 5 and Opera */ | |
-webkit-filter: grayscale(100%); /* Chrome + Safari 6 */ | |
-moz-filter: grayscale(100%); /* Future proof */ | |
-ms-filter: grayscale(100%); /* Future proof */ | |
-o-filter: grayscale(100%); /* Future proof */ | |
filter: grayscale(100%); /* Future proof or polyfilled */ | |
} | |
a { | |
text-decoration: underline; | |
} | |
a[href]:after { | |
content: " (" attr(href) ")"; | |
} | |
a[href="#"], | |
a[href="javascript:"] { | |
content: ""; | |
} | |
} | |
@media | |
only screen and (-webkit-min-device-pixel-ratio: 2), | |
only screen and ( min--moz-device-pixel-ratio: 2), /* Looks like a bug, so may want to add: */ | |
only screen and ( -moz-min-device-pixel-ratio: 2), | |
only screen and ( -o-min-device-pixel-ratio: 2/1), | |
only screen and ( min-device-pixel-ratio: 2), | |
only screen and ( min-resolution: 192dpi), | |
only screen and ( min-resolution: 2dppx) { | |
/* Your retina specific stuff here */ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment