css样式重置方案 -解决浏览器差异
1.http://meyerweb.com/eric/tools/css/reset/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ html, body, div, span, applet, object, iframe, h 1 , h 2 , h 3 , h 4 , h 5 , h 6 , 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 ; } |
2.http://yuilibrary.com/yui/docs/cssreset/
1 2 3 4 5 6 7 8 | /* YUI 3.18.1 (build f7e7bcb) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ html{ color : #000 ; background : #FFF }body,div,dl,dt,dd,ul,ol,li,h 1 ,h 2 ,h 3 ,h 4 ,h 5 ,h 6 , pre , code ,form,fieldset,legend,input,textarea,p,blockquote,th,td{ margin : 0 ; padding : 0 }table{ border-collapse : collapse ; border-spacing : 0 }fieldset,img{ border : 0 }address, caption ,cite, code ,dfn,em,strong,th,var{ font-style : normal ; font-weight : normal }ol,ul{ list-style : none } caption ,th{ text-align : left }h 1 ,h 2 ,h 3 ,h 4 ,h 5 ,h 6 { font-size : 100% ; font-weight : normal }q:before,q:after{ content : '' }abbr,acronym{ border : 0 ; font-variant : normal }sup{ vertical-align : text-top } sub { vertical-align : text-bottom }input,textarea,select{ font-family :inherit; font-size :inherit; font-weight :inherit;* font-size : 100% }legend{ color : #000 }#yui 3 -css-stamp.cssreset{ display : none } |
Getting Started
Include Dependencies
To use CSS Reset, include the following source file in your web page:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">
Global vs. Contextual
YUI's CSS resources apply rules to HTML elements directly (using type selectors). An alternate version of the resource is available that target elements by context only. This contextual -context.css
version selects HTML elements only when they descend from the .yui3-cssreset
classname.
Here is how to include the contextual version of CSS Reset:
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset-context/cssreset-context-min.css">
Using CSS Reset
Using CSS Reset Globally
CSS Reset is easy to use. When CSS Reset is loaded it removes the inconsistent styling of HTML elements provided by browsers. Now, just begin writing the CSS rules your project needs without being burdened by what the browser thinks you need.
Here is an example page showing HTML elements once CSS Reset has been included in the page globally.
Using CSS Reset Contextually
If you're using the contextual version, CSS Reset's rules are only applied to nodes that descend from a node with a class value of .yui3-cssreset
. In this example, CSS Reset applies to the h1
in the left column, but does not impact the h1
in the right column:
<div>
<div id="left-column" class="yui3-cssreset"><h1>Lorem Ipsum</h1></div>
<div id="right-column"><h1>Lorem Ipsum</h1></div>
</div>
Here is an example page where only a portion of the page is impacted because it is being used contextually.
3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* undohtml.css */ /* (CC) 2004 Tantek Celik. Some Rights Reserved. */ /* http://creativecommons.org/licenses/by/2.0 */ /* This style sheet is licensed under a Creative Commons License. */ /* Purpose: undo some of the default styling of common (X)HTML browsers */ /* link underlines tend to make hypertext less readable, because underlines obscure the shapes of the lower halves of words */ :link,:visited { text-decoration : none } /* no list-markers by default, since lists are used more often for semantics */ ul,ol { list-style : none } /* avoid browser default inconsistent heading font-sizes */ /* and pre/code too */ h 1 ,h 2 ,h 3 ,h 4 ,h 5 ,h 6 , pre , code { font-size : 1em ; } /* remove the inconsistent (among browsers) default ul,ol padding or margin */ /* the default spacing on headings does not match nor align with normal interline spacing at all, so let's get rid of it. */ /* zero out the spacing around pre, form, body, html, p, blockquote as well */ /* form elements are oddly inconsistent, and not quite CSS emulatable. */ /* nonetheless strip their margin and padding as well */ ul,ol,li,h 1 ,h 2 ,h 3 ,h 4 ,h 5 ,h 6 , pre ,form,body,html,p,blockquote,fieldset,input { margin : 0 ; padding : 0 } /* whoever thought blue linked image borders were a good idea? */ a img,:link img,:visited img { border : none } /* de-italicize address */ address { font-style : normal } /* more varnish stripping as necessary... */ |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述