HTML5 CSS Reset


/ Published in: CSS
Save to your folder(s)

HTML5 CSS Reset


Copy this code and paste it in your HTML
  1. /**
  2.  * HTML5 � Boilerplate
  3.  *
  4.  * style.css contains a reset, font normalization and some base styles.
  5.  *
  6.  * Credit is left where credit is due.
  7.  * Much inspiration was taken from these projects:
  8.  * - yui.yahooapis.com/2.8.1/build/base/base.css
  9.  * - camendesign.com/design/
  10.  * - praegnanz.de/weblog/htmlcssjs-kickstart
  11.  */
  12.  
  13.  
  14. /**
  15.  * html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
  16.  * v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
  17.  * html5doctor.com/html-5-reset-stylesheet/
  18.  */
  19.  
  20. html, body, body div, span, object, iframe,
  21. h1, h2, h3, h4, h5, h6, p, blockquote, pre,
  22. abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
  23. small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
  24. fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td,
  25. article, aside, canvas, details, figcaption, figure,
  26. footer, header, hgroup, menu, nav, section, summary,
  27. time, mark, audio, video {
  28. margin: 0;
  29. padding: 0;
  30. border: 0;
  31. font-size: 100%;
  32. vertical-align: baseline;
  33. }
  34.  
  35. article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  36. display: block;
  37. }
  38.  
  39. blockquote, q { quotes: none; }
  40.  
  41. blockquote:before, blockquote:after,
  42. q:before, q:after { content: ""; content: none; }
  43.  
  44. ins { background-color: #ff9; color: #000; text-decoration: none; }
  45.  
  46. mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
  47.  
  48. del { text-decoration: line-through; }
  49.  
  50. abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
  51.  
  52. table { border-collapse: collapse; border-spacing: 0; }
  53.  
  54. hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
  55.  
  56.  
  57. /**
  58.  * Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
  59.  */
  60.  
  61. body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
  62.  
  63. /* Normalize monospace sizing:
  64.   en.wikipedia.org/wiki/MediaWiki_talk:Common.css/Archive_11#Teletype_style_fix_for_Chrome */
  65. pre, code, kbd, samp { font-family: monospace, sans-serif; }
  66.  
  67.  
  68. /**
  69.  * Minimal base styles.
  70.  */
  71.  
  72. /* 1) Always force a scrollbar in non-IE
  73.   2) Remove iOS text size adjust without disabling user zoom: www.456bereastreet.com/archive/201012/controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */
  74. html { overflow-y: scroll; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; }
  75.  
  76. /* j.mp/webkit-tap-highlight-color */
  77. a:link { -webkit-tap-highlight-color: #FF5E99; }
  78.  
  79. /* Accessible focus treatment: people.opera.com/patrickl/experiments/keyboard/test */
  80. a:hover, a:active { outline: none; }
  81.  
  82. a, a:active, a:visited { color: #607890; }
  83. a:hover { color: #036; }
  84.  
  85. ul, ol { margin-left: 2em; }
  86. ol { list-style-type: decimal; }
  87.  
  88. /* Remove margins for navigation lists */
  89. nav ul, nav li { margin: 0; list-style:none; list-style-image: none; }
  90.  
  91. small { font-size: 85%; }
  92. b, strong, th { font-weight: bold; }
  93.  
  94. td { vertical-align: top; }
  95.  
  96. /* Set sub, sup without affecting line-height: gist.github.com/413930 */
  97. sub, sup { font-size: 75%; line-height: 0; position: relative; }
  98. sup { top: -0.5em; }
  99. sub { bottom: -0.25em; }
  100.  
  101. pre {
  102. /* www.pathf.com/blogs/2008/05/formatting-quoted-code-in-blog-posts-css21-white-space-pre-wrap/ */
  103. white-space: pre; white-space: pre-wrap; word-wrap: break-word;
  104. padding: 15px;
  105. }
  106.  
  107. .ie6 legend, .ie7 legend { margin-left: -7px; }
  108.  
  109. /* 1) Make inputs and buttons play nice in IE: www.viget.com/inspire/styling-the-button-element-in-internet-explorer/
  110.   2) WebKit browsers add a 2px margin outside the chrome of form elements.
  111.   Firefox adds a 1px margin above and below textareas
  112.   3) Set font-size to match <body>'s, and font-family to sans-serif
  113.   4) Align to baseline */
  114. button, input, select, textarea { width: auto; overflow: visible; margin: 0; font-size: 100%; font-family: sans-serif; vertical-align: baseline; }
  115.  
  116. /* 1) Remove default scrollbar in IE: www.sitepoint.com/blogs/2010/08/20/ie-remove-textarea-scrollbars/
  117.   2) Align to text-top */
  118. textarea { overflow: auto; vertical-align:text-top; }
  119.  
  120. /* Hand cursor on clickable input elements */
  121. label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; }
  122.  
  123. /* Remove extra padding and inner border in Firefox */
  124. input::-moz-focus-inner,
  125. button::-moz-focus-inner { border: 0; padding: 0; }
  126.  
  127. /* Colors for form validity */
  128. input:valid, textarea:valid { }
  129. input:invalid, textarea:invalid { border-radius: 1px; -moz-box-shadow: 0px 0px 5px red; -webkit-box-shadow: 0px 0px 5px red; box-shadow: 0px 0px 5px red; }
  130. .no-boxshadow input:invalid, .no-boxshadow textarea:invalid { background-color: #f0dddd; }
  131.  
  132. /* Bicubic resizing for non-native sized IMG:
  133.   code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/ */
  134. .ie7 img { -ms-interpolation-mode: bicubic; }
  135.  
  136.  
  137. /**
  138.  * You might tweak these..
  139.  */
  140.  
  141. body, select, input, textarea {
  142. /* #444 looks better than black: twitter.com/H_FJ/statuses/11800719859 */
  143. color: #444;
  144. /* Set your base font here, to apply evenly */
  145. /* font-family: Georgia, serif; */
  146. }
  147.  
  148. /* Headers (h1, h2, etc) have no default font-size or margin; define those yourself */
  149. h1, h2, h3, h4, h5, h6 { font-weight: bold; }
  150.  
  151. /* These selection declarations have to be separate
  152.   No text-shadow: twitter.com/miketaylr/status/12228805301
  153.   Also: hot pink! */
  154. ::-moz-selection { background: #fe57a1; color:#fff; text-shadow: none; }
  155. ::selection { background:#fe57a1; color:#fff; text-shadow: none; }
  156.  
  157. /**
  158.  * Primary styles
  159.  *
  160.  * Author:
  161.  */
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. /**
  179.  * Non-semantic helper classes: please define your styles before this section.
  180.  */
  181.  
  182. /* For image replacement */
  183. .ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }
  184. .ir br { display: none; }
  185.  
  186. /* Hide for both screenreaders and browsers:
  187.   css-discuss.incutio.com/wiki/Screenreader_Visibility */
  188. .hidden { display: none; visibility: hidden; }
  189.  
  190. /* Hide only visually, but have it available for screenreaders: by Jon Neal.
  191.   www.webaim.org/techniques/css/invisiblecontent/ & j.mp/visuallyhidden */
  192. .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
  193. /* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: drupal.org/node/897638 */
  194. .visuallyhidden.focusable:active,
  195. .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
  196.  
  197. /* Hide visually and from screenreaders, but maintain layout */
  198. .invisible { visibility: hidden; }
  199.  
  200. /* The Magnificent Clearfix: Updated to prevent margin-collapsing on child elements in most situations.
  201.   nicolasgallagher.com/micro-clearfix-hack/ */
  202. .clearfix:before, .clearfix:after { content: ""; display: table; }
  203. .clearfix:after { clear: both; }
  204. .clearfix { zoom: 1; }
  205.  
  206.  
  207.  
  208. /**
  209.  * Placeholder media queries for responsive design. Modify as design requires.
  210.  * These follow after, and will override, the primary ('mobile first') styles
  211.  * The closing /mediaquery comment is required by respond.js min/max-width Media Query polyfill
  212.  */
  213.  
  214. @media only screen and (min-width: 480px) {
  215. /* Style adjustments for viewports 480px and over go here */
  216.  
  217. }/*/mediaquery*/
  218.  
  219. @media only screen and (min-width: 768px) {
  220. /* Style adjustments for viewports 768px and over go here */
  221.  
  222. }/*/mediaquery*/
  223.  
  224.  
  225.  
  226. /**
  227.  * Print styles.
  228.  *
  229.  * Inlined to avoid required HTTP connection: www.phpied.com/delay-loading-your-print-css/
  230.  */
  231. @media print {
  232. * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
  233. -ms-filter: none !important; } /* Black prints faster: sanbeiji.com/archives/953 */
  234. a, a:visited { color: #444 !important; text-decoration: underline; }
  235. a[href]:after { content: " (" attr(href) ")"; }
  236. abbr[title]:after { content: " (" attr(title) ")"; }
  237. .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */
  238. pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
  239. thead { display: table-header-group; } /* css-discuss.incutio.com/wiki/Printing_Tables */
  240. tr, img { page-break-inside: avoid; }
  241. img { max-width: 100% !important; }
  242. @page { margin: 0.5cm; }
  243. p, h2, h3 { orphans: 3; widows: 3; }
  244. h2, h3{ page-break-after: avoid; }
  245. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.