CSS Snippets
Browser Reset
Browserspezifische Stylesheets zurücksetzen
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
iPad media queries
Unterschiedliches Styles für iPad im Hoch- und Querformat
@media only screen and (device-width: 768px) {
/* iPad allgemein */
}
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
/* iPad Hochformat (protrait) */
}
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
/* iPad Querformat (landscape) */
}
Transparenz
Transparenz-Einstellung für alle Browser
.transparent {
zoom: 1;
filter: alpha(opacity=50);
opacity: 0.5;
}
1x1 Pixel transparentes GIF (inline)
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">
Bilder umwandeln
Elemente in Graustufen umwandeln (funktioniert nicht mehr unter IE10+)
.grayed-out {
filter: url("data:image/svg+xml;utf8,<svg 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>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
}
Internet Explorer
Styles für spezielle IE Version (5-9)
<!--[if IE]> /* IE 5-9 */ <![endif]-->
<!--[if !IE]> /* Not IE 5-9 */ <![endif]-->
<!--[if IE 6]> /* IE 6 */ <![endif]-->
<!--[if gt IE 7]> /* Greater than IE 7 */ <![endif]-->
<!--[if gte IE 8]> /* IE 8+ */ <![endif]-->
<!--[if lt IE 9]> /* Before IE 9 */ <![endif]-->
<!--[if lte IE 8]> /* IE 8 or older */ <![endif]-->
Styles für IE 10+ (Hack)
@@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE 10 or higher */
}