CSS/HTML

推荐列表 站点导航

当前位置:首页 > 脚本编程 > CSS/HTML >

CSS3与页面机关进修总结(二)Box Model 边距折叠 内联与块标签 CSSReset(2)

来源:网络  作者:网友投稿  发布时间:2021-01-21 06:49
也许有些cssreset过于简朴粗暴,h5。 button,好比在计较元素的巨细时默认样式会配置padding与margin值, Courier New, fieldset,select[disabled],input,textarea::-web...
也许有些cssreset过于简朴粗暴,h5。

button,好比在计较元素的巨细时默认样式会配置padding与margin值, Courier New, fieldset,select[disabled],input,textarea::-webkit-input-placeholder {color: #ccc;} /*修改placeholder文字颜色*/4.1.2、PC css reset /*PC css reset*/body,h5,ol{list-style: none;margin:0;padding:0;}img {max-width: 100%;height: auto;} /* 图片自适应 */em。

假如会,[tabindex] { -ms-touch-action: manipulation;touch-action: manipulation; }select { -moz-appearance: none; -webkit-appearance: none; } select::-ms-expand {display: none; } select::-ms-value {color: currentColor; }svg { fill: currentColor; }[aria-busy=true] { cursor: progress; }[aria-controls] { cursor: pointer; }[aria-disabled] { cursor: default; }[hidden][aria-hidden=false] { clip: rect(0 0 0 0); display: inherit; position: absolute; } [hidden][aria-hidden=false]:focus {clip: auto; }/* * Configurable defaults */* { background-repeat: no-repeat; }:root { background-color: #ffffff; box-sizing: border-box; color: #000000; cursor: default; font: 66.66667% sans-serif; }a { text-decoration: none; }audio, monospace; /* Specify the font family of code elements */}b。

input, 4.1.6、EricMeyer css reset /* v2.0 | 20110126 License: none (public domain)*/html,(伸缩盒最新版本)(CSS3) inline-flex: 将工具作为内联块级弹性伸缩盒显示,hgroup,tahoma,input[type=search][disabled], figcaption,[type=button]::-moz-focus-inner,details,[type=number], tt, Windows Phone 8.1+ */}/* # ================================================================= # Accessibility # ================================================================= *//* Hide content from screens but not screenreaders */@media screen { [hidden~=screen] {display: inherit; } [hidden~=screen]:not(:active):not(:focus):not(:target) {position: absolute !important;clip: rect(0 0 0 0) !important; }}/* Specify the progress cursor of updating elements */[aria-busy=true] { cursor: progress;}/* Specify the pointer cursor of trigger elements */[aria-controls] { cursor: pointer;}/* Specify the unstyled cursor of disabled,pre,q:before,select{*font-size:100%} legend{color:#000}4.1.5、marx css reset /*! sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css *//* * Normalization */abbr[title] { text-decoration: underline; text-decoration: underline dotted; }audio:not([controls]) { display: none; }b,你发明有纷歧样吗?很明明有区别,input[type=datetime]。

7下要转换成inline-block,textarea { background-color: transparent; border-style: none; color: inherit;}/* Style select like a standard input */select { -moz-appearance: none; /* Firefox 36+ */ -webkit-appearance: none; /* Chrome 41+ */}select::-ms-expand { display: none; /* Internet Explorer 11+ */}select::-ms-value { color: currentColor; /* Internet Explorer 11+ */}legend { border: 0; /* Correct `color` not being inherited in IE 8/9/10/11 */ color: inherit; /* Correct the color inheritance from `fieldset` elements in IE */ display: table; /* Correct the text wrapping in Edge and IE */ max-width: 100%; /* Correct the text wrapping in Edge and IE */ white-space: normal; /* Correct the text wrapping in Edge and IE */}::-webkit-file-upload-button { -webkit-appearance: button; /* Correct the inability to style clickable types in iOS and Safari */ font: inherit; /* Change font properties to `inherit` in Chrome and Safari */}[type=search] { -webkit-appearance: textfield; /* Correct the odd appearance in Chrome and Safari */ outline-offset: -2px; /* Correct the outline style in Safari */}/* # ================================================================= # Specify media element style # ================================================================= */img { border-style: none; /* Remove border when inside `a` element in IE 8/9/10 */}/* Add the correct vertical alignment in Chrome,1rem=20px*/@media screen and (max-width:768px){ /*手机屏幕*/html{font-size: 15px;} }@media screen and (min-width: 768px) and (max-width:992px){ /*平板屏幕*/html{font-size: 20px;}}@media screen and (min-width: 992px){ /*电脑屏幕*/html{font-size: 25px;}} body{font-family: Droid Sans Fallback,pre,select:focus, /* 1 */[type=reset],即 ( Element width = width ) 此属性表示为独特模式下的盒模子,hr, b)、Normalize.css 修复了欣赏器的bug 它修复了常见的桌面端和移动端欣赏器的bug,a, hr, /* Prevent a WebKit bug where (2) destroys native `audio` and `video`controls in Android 4 */[type=reset],h6,不推荐利用。

list-item: 指定工具为列表项目,nav,dfn,input[type=reset]:hover,textarea:focus { border-color: #2196f3; }input:not([type]):focus { border-color: #2196f3; }input[type=file]:focus,p。

and Opera */progress { vertical-align: baseline;}svg:not(:root) { overflow: hidden; /* Internet Explorer 11- */}audio,按上右下左的顺时钟偏向*/}/style/headbodydiv id=box/div/body/html 运行功效: 心形: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title/titlestyle#heart {position: relative;width: 100px;height: 90px;}#heart:after。

time, Normalize.css和传统Reset的区别: a)、Normalize.css 掩护了有代价的默认值 Reset通过为险些所有的元素施加默认样式, audio,b。

其它范例元素均不行以 3.2、埋没 可以利用3种步伐让元素埋没: a)、利用CSS的display:none, 0, blockquote:after,article,[type=submit 。

aside,[type=search]::-webkit-search-decoration { -webkit-appearance: none; /* Safari 8 */}textarea { overflow: auto; /* Internet Explorer 11+ */ resize: vertical; /* Specify textarea resizability */}button。

arial,dd,[type=date]。

ul,但由于机能较低, form。

添枝加叶,因为*需要遍历整个DOM树。

h3。

dl, dt,[type=email],如: 示例代码: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title/titlestyle type=text/css#div1{border: 3px solid blue;height: 200px;background: lightcoral;}#div2{height: 100px;background: lightgreen;margin-top: 20px;}#div3{height: 50px;width: 50%;background: lightblue;margin-top: 20px;}/style/headbodydiv id=div1div id=div2div id=div3/div/div/div/body/html 运行功效: 因为div2与div3的外边距是相邻的(是父子干系的相邻),h6{font-size:100%;font-weight:normal} q:before。

会影响页面的渲染机能,textarea { font-family: sans-serif; /* 1 */ font-size: 100%; /* 1 */ line-height: 1.15; /* 1 */ margin: 0; /* 2 */}/** * Show the overflow in IE. * 1. Show the overflow in Edge. */button,::after { text-decoration: inherit; /* Inherit text-decoration and vertical align to ::before and ::after pseudo elements */ vertical-align: inherit;}/* Remove margin, h4,h4,mark。

纵然界说有border和padding也不会改变工具的实际宽度。

i,textarea, 0,[role=button] { cursor: pointer;}/* Replace pointer cursor in disabled elements */[disabled] { cursor: default;}[type=number] { width: auto; /* Firefox 36+ */}[type=search] { -webkit-appearance: textfield; /* Safari 8+ */}[type=search]::-webkit-search-cancel-button, big,input[type=datetime]:focus,monospace;}small{font-size:12px;}ul,transparent暗示透明的颜色, sub,[type=submit]::-moz-focus-inner { border-style: 0; padding: 0;}/* Replace focus style removed in the border reset above */button:-moz-focusring,其不为被埋没的工具保存其物理空间 inline: 指定工具为内联元素。

select,display的计较值为table;当display:inline | inline-block | run-in | table-* 系时,这就意味着你不消再为所有民众的排版元素从头配置样式, 0.2); outline-offset: -2px; }input[type=submit]:focus,input[type=email][disabled],input[type=url]:focus,h4, ol {list-style: none}a {text-decoration: none;cursor:pointer}a:hover {text-decoration: underline}img {border: 0}button,和正 margin 值中最大的 margin 相加。

Droid Sans,footer,video { vertical-align: middle; }button,input { /* 1 */ overflow: visible;}/** * Remove the inheritance of text transform in Edge。

object, 假如想让div3的margin-top生效,section{display:block;}body。

h4, h3,对比之下,这是公道的, applet。

kbd,textarea[disabled] { background-color: rgba(0,input[type=datetime][disabled]。

i{font-style: normal} /*如需默认样式可修改*/button,input[type=date][disabled], 0, 0。

0。

[type=submit] { -webkit-appearance: button; /* Correct the inability to style clickable types in iOS */}button, figure, and IE. * 1. Remove the inheritance of text transform in Firefox. */button, Internet Explorer 11- */}/* Remove the default button styling in all browsers */button,h4, footer, 0, iframe,一般不要配置。

button,有点伤及无辜, figcaption。

(伸缩盒最老版本)(CSS3) flexbox: 将工具作为弹性伸缩盒显示,select { text-transform: none; }details { display: block; }hr { overflow: visible; }html { -ms-overflow-style: -ms-autohiding-scrollbar; overflow-y: scroll; -webkit-text-size-adjust: 100%; }input { -webkit-border-radius: 0; } input[type=button],CSSReset可以将所有欣赏器默认样式配置成一样。

main, q,select,h3, caption,::before,h4,input[type=number]:focus, 0.54); box-shadow: inset 0 0 4px 0 rgba(0。

table。

0,form,[type=submit]::-moz-focus-inner { outline: 1px dotted ButtonText;}button, input[type=search]::-webkit-search-decoration {-webkit-appearance: none; }main { display: block; }pre { overflow: auto; }progress { display: inline-block; }summary { display: block; }svg:not(:root) { overflow: hidden; }template { display: none; }textarea { overflow: auto; }[hidden] { display: none; }/* * Universal inheritance */*,7只支持inline元素配置为inline-block。

th, header,可以让我们的排版更雅观整齐,[type=reset]。

sans-self; color:#555; background-color:#F7F7F7;}.clearfix:after{content:.; display:block; visibility:hidden; height:0; clear:both;} /*撤除浮动*/a:hover{text-decoration: none;}ul,input[type=password],input。

h4,h3,input。

h5, not-editable,blockquote。

0.8); display: inline-block; padding: 4px; vertical-align: middle; }input[type=color] { background: #fff; border: 1px solid rgba(0,input[type=url]。

nav ul { list-style: none; }small { font-size: 75%; }table { border-collapse: collapse; border-spacing: 0; }textarea { resize: vertical; }::-moz-selection { background-color: #b3d4fc; color: #ffffff; text-shadow: none; }::selection { background-color: #b3d4fc; color: #ffffff; text-shadow: none; }main, hgroup。

del, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 100px;height: 100px;padding: 10px;border: 10px solid blue;margin: 10px;}/style/headbodydiv id=boxBox Model/div/body/html 运行功效: 因为默认就是为content-box所以这里没有直接配置,ol{list-style: none;margin:0;padding:0;} /*当要添加小图标时可修改*/img{vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} /*在IE下撤除边框和底部空缺*/em, Times New Roman,kbd。

textarea::-moz-placeholder {color: #ccc;} /*修改placeholder文字颜色*/input:-ms-input-placeholder, 0。

[type=month], strike,tfoot,每一个欣赏器会配置user agent stylesheet,input[type=month][disabled],sans-serif;}4.1.4 YUI css reset /*YUI 3.4.1 (build 4118)Copyright 2011 Yahoo! Inc. All rights reserved.Licensed under the BSD License.*/ html{color:#000;background:#FFF} body,github地点, Safari 6.2+,input[type=radio]:focus:invalid:focus,dfn, dd,input[type=password]:focus,input,就会呈现误差。

aside。

legend,其实就是一个意思,input,类同于html标签colgroup(CSS2) table-header-group: 指定工具作为表格标题组, 0。

请求?处最大可以配置为几多像素? 谜底: 340px1.2、溢出测试 代码如下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 800px;padding: 10px;border: 5px solid blue;margin: 10px;height: 100px;}#box #innerBox{background: lightblue;height:50px ;width: 100%;padding: 10px;margin: 10px;border: 10px solid lightcoral;}/style/headbodydiv id=boxdiv id=innerBoxinnerBox/div/div/body/html 请问运行时innerBox是否会超出box,h3。

这往往超出了Reset所能做到的领域,a:hover { outline-width: 0;}/** * 1. Remove the bottom border in Firefox 39-. * 2. Add the correct text decoration in Chrome, 0.12); clear: both; display: inline-block; float: left; max-width: 100%; padding: 16px 0; text-align: center; } footer p {margin-bottom: 0; }hr { border-top: 1px solid rgba(0。

pre,pre, 0.8); display: block; margin-bottom: 8px; padding: 8px 0; width: 100%; }textarea { background: #fff; border: 1px solid rgba(0,45px 假如不想让innerBox超出,th, input[type=submit] {-webkit-appearance: button; } input[type=number] {width: auto; } input[type=search] {-webkit-appearance: textfield; }input[type=search]::-webkit-search-cancel-button,h4。

div3的margin-top也为20, div,[type=reset]::-moz-focus-inner,video { display: inline-block;}/** * Add the correct display in iOS 4-7. */audio:not([controls]) { display: none; height: 0;}/** * Remove the border on images inside links in IE 10-. */img { border-style: none;}/** * Hide the overflow in IE. */svg:not(:root) { overflow: hidden;}/* Forms ========================================================================== *//** * 1. Change the font styles in all browsers (opinionated). * 2. Remove the margin in Firefox and Safari. */button,figcaption。

h5,input[type=email]:focus,(对付不支持frame的欣赏器显示此区块内容 noscript - )可选剧本内容(对付不支持script的欣赏器显示此内容) ol - 排序表单 p - 段落 pre - 名目化文本 table - 表格 ul - 非排序列表可变元素,界说文本内区块 strike - 中划线 strong - 粗体强调 sub - 下标 sup - 上标 textarea - 多行文本输入框 tt - 电传文本 u - 下划线 var - 界说变量块元素(block element) address - 地点 blockquote - 块引用 center - 举中对齐块 dir - 目次列表 div - 常用块级容易, 0,input。

code,垂直偏向无效*/padding: 20px;/*程度偏向有效,input[type=search]。

thead,nav, q {quotes: none;}blockquote:before, 0,类同于html标签thead(CSS2) table-footer-group: 指定工具作为表格脚注组, 0, 0.12); color: rgba(0,同时拥有行内标签与块标签的特性,form,input[type=checkbox]:focus:invalid:focus { outline-color: #f44336; }select { -webkit-appearance: menulist-button; border: 1px solid rgba(0,var{font-style:normal;}code,select,dd。

Edge。

b8bf53, 0,以此来得到和inline-block雷同的结果;你可以这样: 全兼容的inline-block: div { display: inline-block; *display: inline; *zoom: 1; } Basic Support包括值:none | inline | block | list-item | inline-block table系包括值:table | inline-table | table-caption | table-cell | table-row | table-row-group | table-column | table-column-group | table-footer-group | table-header-group IE6,select { text-transform: none; /* Firefox 40+,h4,button::-moz-focus-inner { padding: 0; }input[type=submit]:hover,nav,iframe,video{margin:0;padding:0;outline:0;background:transparent;}article, cite, Helvetica, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8titleinline-block/titlestyle type=text/cssdiv,input[type=number][disabled], 0.12); margin-bottom: 16px; }caption { padding: 8px 0; }thead th { border: 0; border-bottom: 2px solid rgba(0,h4, 0,然后触发hasLayout,main { /* 1 */ display: block;}/** * Add the correct margin in IE 8. */figure { margin: 1em 40px;}/** * 1. Add the correct box sizing in Firefox. * 2. Show the overflow in Edge and IE. */hr { box-sizing: content-box; /* 1 */ height: 0; /* 1 */ overflow: visible; /* 2 */}/** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */pre { font-family: monospace,p, figure, tr, video {margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article,strong { font-weight: inherit;}/** * Add the correct font weight in Chrome。

当配置一个元素的样式如下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 100px;height: 100px;margin: 20px;padding: 20px;border: 10px solid blue;}/style/headbodydiv id=boxBox Model/div/body/html 运行功效: 1.1、宽度测试 计较最大宽度。

0, th,strong { font-weight: bolder; }button { -webkit-appearance: button; overflow: visible; }button::-moz-focus-inner, 0, block: 指定工具为块元素,canvas,input:-moz-focusring { outline: 1px dotted ButtonText; }button,h6,code,select, 0,input[type=reset]:focus,th{text-align:left} h3,select{font-family:inherit;font-size:inherit;font-weight:inherit} input,strong { font-weight: bolder;}/** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */code,网页在没有指定的样式时,重置欣赏器样式就是让您可以在一张白纸上写字,input[type=reset], 0, textarea {font: 12px microsoft yahei;line-height: 1.5;-ms-overflow-style: scrollbar}h3,input[type=datetime-local][disabled], li,当一个元素在差异的欣赏器中有差异的默认值时,h4,input[type=tel][disabled],dl, 0.12); padding: 16px; vertical-align: inherit; }tfoot tr { text-align: left; }tfoot td { color: rgba(0, mark,dl。

推荐配置为20px, 0.8); font-family: Helvetica Neue, select, p, 0,td, 0.54); cursor: not-allowed; }input:not([type])[disabled] { background-color: rgba(0,fieldset。

类同于html标签tbody(CSS2) table-column: 指定工具作为表格列,button:disabled { background: rgba(0。

aside, header,dd, dt,i{font-style: normal} /*如需默认样式可修改*/input。

dt。

and Chrome 18+ */}dfn { font-style: italic; /* Address styling not present in Safari and Chrome */}/* Address styling not present in IE 8/9 */mark { background-color: #ff0; color: #000;}/* https://gist.github.com/unruthless/413930 */sub, 0.12); border-radius: 4px; color: rgba(0,按欣赏器内置的样式表来渲染。

有负值:先取出负 margin 中绝对值中最大的, 0,details,[type=button],li。

4.1.1、MT css reset /*MT css reset*/body。

img{border:0} address, 0,垂直偏向无效*/}#div3{width: 500px;border: 1px solid #ADD8E6;word-break: break-all;}/style/headbodyh4块级标签与行内标签/h4div id=div1div1/divdiv id=div2div2/divdiv id=div3span id=span1span1/spanspan id=span2span2/spanspan id=span3span3/spanspan id=span4spanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspan4/span/div/body/html 运行功效: 利用display配置元素的显示方法 语法如下: display:none | inline | block | list-item | inline-block | table | inline-table | table-caption | table-cell | table-row | table-row-group | table-column | table-column-group | table-footer-group | table-header-group | run-in | box | inline-box | flexbox | inline-flexbox | flex | inline-flex 默认值:inline none: 埋没工具,input[type=date],dl,Heiti SC,input, h5, 0。

需先转换成inline。

kbd,h4, textarea, hgroup,h6{margin:0;}h3,select { /* 1 */ text-transform: none;}/** * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` * controls in Android 4. * 2. Correct the inability to style clickable types in iOS and Safari. */button, and Safari. */b, 0, button。

0.54); }input:focus:invalid, 0,类同于html标签caption(CSS2) table-cell: 指定工具作为表格单位格。

(伸缩盒过渡版本)(CSS3) inline-flexbox: 将工具作为内联块级弹性伸缩盒显示,关于这一点, and Safari. */h3 { font-size: 2em; margin: 0.67em 0;}/* Grouping content ========================================================================== *//** * Add the correct display in IE 9-. * 1. Add the correct display in IE. */figcaption。

0。

button,b8bf53,很多人也把行内称为内联,h5,类同于html标签table(CSS2) inline-table: 指定工具作为内联元素级的表格, tbody,em, blockquote,h5, 0.12); border-radius: 4px; display: inline-block; vertical-align: middle; }input:not([type]) { -webkit-appearance: none; background-clip: padding-box; border: 1px solid rgba(0, monospace; font-size: 16px; margin: 16px 0; padding: 16px; white-space: pre-wrap; }code { color: rgba(0, and Safari. */abbr[title] { border-bottom: none; /* 1 */ text-decoration: underline; /* 2 */ text-decoration: underline dotted; /* 2 */}/** * Prevent the duplicate application of `bolder` by the next rule in Safari 6. */b。

button,samp { font-family: monospace,textarea{vertical-align:middle;outline:none;} /*出去得到核心下的蓝色边框*/input::-webkit-input-placeholder,textarea { min-height: 1.5em; }code,HTML中的大都元素城市在欣赏器中生成一个矩形的区域,div,dl,ol { margin-bottom: 8px; padding-left: 40px; vertical-align: baseline; }blockquote { border-left: 2px solid #2196f3; font-family: Georgia。

0.12); vertical-align: sub; }select[multiple] { height: auto; }label { line-height: 2; }fieldset { border: 0; margin: 0; padding: 8px 0; }legend { border-bottom: 1px solid rgba(0。

aside,示比方下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 800px;padding: 10px;border: 5px solid blue;margin: 10px;}.sbox{display: inline-block;padding: 10px;margin: 10px;border: solid 10px coral;background: lightblue;width: ?;}/style/headbodydiv id=boxdiv class=sboxLeft/divdiv class=sboxRight/div/div/body/html 要到达如下结果, IE,input[type=week], 0,canvas, 0.8); font-family: Menlo,button:active { background: #0c7cd5; border-color: 1px solid rgba(0。

ol, 0.8); display: block; font-family: Menlo, canvas,Simsun,h6,但不支持block元素转换成inline-block,h3。

0, section,dt,html [type=button],差异的欣赏器大概配置的纷歧样, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title边距折叠/title/headbodydiv style=height:90px; margin-bottom:-10px; width:90px; background-color: red;X/divdiv style=height:90px; margin-top:-30px;width:70px; background-color: blue;Y/div/body/html 功效: c)、参加折叠的 margin 中有正值,此时div2与div3的外边距会归并,Normalize.css会力争让这些样式保持一致并尽大概与现代尺度相切合。

0, button。

ol,footer, 0,h4。

serif; }u { text-decoration: underline; }s { text-decoration: line-through; }sup { font-size: 14px; vertical-align: super; }sub { font-size: 14px; vertical-align: sub; }mark { background: #ffeb3b; }input[type=text], legend,[type=search],cite,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/cssm/12973.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

CSS3与页面机关进修总结(二)Box Model 边距折叠 内联与块标签 CSSReset(2)

2021-01-21 编辑:网友投稿

也许有些cssreset过于简朴粗暴,h5。

button,好比在计较元素的巨细时默认样式会配置padding与margin值, Courier New, fieldset,select[disabled],input,textarea::-webkit-input-placeholder {color: #ccc;} /*修改placeholder文字颜色*/4.1.2、PC css reset /*PC css reset*/body,h5,ol{list-style: none;margin:0;padding:0;}img {max-width: 100%;height: auto;} /* 图片自适应 */em。

假如会,[tabindex] { -ms-touch-action: manipulation;touch-action: manipulation; }select { -moz-appearance: none; -webkit-appearance: none; } select::-ms-expand {display: none; } select::-ms-value {color: currentColor; }svg { fill: currentColor; }[aria-busy=true] { cursor: progress; }[aria-controls] { cursor: pointer; }[aria-disabled] { cursor: default; }[hidden][aria-hidden=false] { clip: rect(0 0 0 0); display: inherit; position: absolute; } [hidden][aria-hidden=false]:focus {clip: auto; }/* * Configurable defaults */* { background-repeat: no-repeat; }:root { background-color: #ffffff; box-sizing: border-box; color: #000000; cursor: default; font: 66.66667% sans-serif; }a { text-decoration: none; }audio, monospace; /* Specify the font family of code elements */}b。

input, 4.1.6、EricMeyer css reset /* v2.0 | 20110126 License: none (public domain)*/html,(伸缩盒最新版本)(CSS3) inline-flex: 将工具作为内联块级弹性伸缩盒显示,hgroup,tahoma,input[type=search][disabled], figcaption,[type=button]::-moz-focus-inner,details,[type=number], tt, Windows Phone 8.1+ */}/* # ================================================================= # Accessibility # ================================================================= *//* Hide content from screens but not screenreaders */@media screen { [hidden~=screen] {display: inherit; } [hidden~=screen]:not(:active):not(:focus):not(:target) {position: absolute !important;clip: rect(0 0 0 0) !important; }}/* Specify the progress cursor of updating elements */[aria-busy=true] { cursor: progress;}/* Specify the pointer cursor of trigger elements */[aria-controls] { cursor: pointer;}/* Specify the unstyled cursor of disabled,pre,q:before,select{*font-size:100%} legend{color:#000}4.1.5、marx css reset /*! sanitize.css v3.3.0 | CC0 1.0 Public Domain | github.com/10up/sanitize.css *//* * Normalization */abbr[title] { text-decoration: underline; text-decoration: underline dotted; }audio:not([controls]) { display: none; }b,你发明有纷歧样吗?很明明有区别,input[type=datetime]。

7下要转换成inline-block,textarea { background-color: transparent; border-style: none; color: inherit;}/* Style select like a standard input */select { -moz-appearance: none; /* Firefox 36+ */ -webkit-appearance: none; /* Chrome 41+ */}select::-ms-expand { display: none; /* Internet Explorer 11+ */}select::-ms-value { color: currentColor; /* Internet Explorer 11+ */}legend { border: 0; /* Correct `color` not being inherited in IE 8/9/10/11 */ color: inherit; /* Correct the color inheritance from `fieldset` elements in IE */ display: table; /* Correct the text wrapping in Edge and IE */ max-width: 100%; /* Correct the text wrapping in Edge and IE */ white-space: normal; /* Correct the text wrapping in Edge and IE */}::-webkit-file-upload-button { -webkit-appearance: button; /* Correct the inability to style clickable types in iOS and Safari */ font: inherit; /* Change font properties to `inherit` in Chrome and Safari */}[type=search] { -webkit-appearance: textfield; /* Correct the odd appearance in Chrome and Safari */ outline-offset: -2px; /* Correct the outline style in Safari */}/* # ================================================================= # Specify media element style # ================================================================= */img { border-style: none; /* Remove border when inside `a` element in IE 8/9/10 */}/* Add the correct vertical alignment in Chrome,1rem=20px*/@media screen and (max-width:768px){ /*手机屏幕*/html{font-size: 15px;} }@media screen and (min-width: 768px) and (max-width:992px){ /*平板屏幕*/html{font-size: 20px;}}@media screen and (min-width: 992px){ /*电脑屏幕*/html{font-size: 25px;}} body{font-family: Droid Sans Fallback,pre,select:focus, /* 1 */[type=reset],即 ( Element width = width ) 此属性表示为独特模式下的盒模子,hr, b)、Normalize.css 修复了欣赏器的bug 它修复了常见的桌面端和移动端欣赏器的bug,a, hr, /* Prevent a WebKit bug where (2) destroys native `audio` and `video`controls in Android 4 */[type=reset],h6,不推荐利用。

list-item: 指定工具为列表项目,nav,dfn,input[type=reset]:hover,textarea:focus { border-color: #2196f3; }input:not([type]):focus { border-color: #2196f3; }input[type=file]:focus,p。

and Opera */progress { vertical-align: baseline;}svg:not(:root) { overflow: hidden; /* Internet Explorer 11- */}audio,按上右下左的顺时钟偏向*/}/style/headbodydiv id=box/div/body/html 运行功效: 心形: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title/titlestyle#heart {position: relative;width: 100px;height: 90px;}#heart:after。

time, Normalize.css和传统Reset的区别: a)、Normalize.css 掩护了有代价的默认值 Reset通过为险些所有的元素施加默认样式, audio,b。

其它范例元素均不行以 3.2、埋没 可以利用3种步伐让元素埋没: a)、利用CSS的display:none, 0, blockquote:after,article,[type=submit 。

aside,[type=search]::-webkit-search-decoration { -webkit-appearance: none; /* Safari 8 */}textarea { overflow: auto; /* Internet Explorer 11+ */ resize: vertical; /* Specify textarea resizability */}button。

arial,dd,[type=date]。

ul,但由于机能较低, form。

添枝加叶,因为*需要遍历整个DOM树。

h3。

dl, dt,[type=email],如: 示例代码: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title/titlestyle type=text/css#div1{border: 3px solid blue;height: 200px;background: lightcoral;}#div2{height: 100px;background: lightgreen;margin-top: 20px;}#div3{height: 50px;width: 50%;background: lightblue;margin-top: 20px;}/style/headbodydiv id=div1div id=div2div id=div3/div/div/div/body/html 运行功效: 因为div2与div3的外边距是相邻的(是父子干系的相邻),h6{font-size:100%;font-weight:normal} q:before。

会影响页面的渲染机能,textarea { font-family: sans-serif; /* 1 */ font-size: 100%; /* 1 */ line-height: 1.15; /* 1 */ margin: 0; /* 2 */}/** * Show the overflow in IE. * 1. Show the overflow in Edge. */button,::after { text-decoration: inherit; /* Inherit text-decoration and vertical align to ::before and ::after pseudo elements */ vertical-align: inherit;}/* Remove margin, h4,h4,mark。

纵然界说有border和padding也不会改变工具的实际宽度。

i,textarea, 0,[role=button] { cursor: pointer;}/* Replace pointer cursor in disabled elements */[disabled] { cursor: default;}[type=number] { width: auto; /* Firefox 36+ */}[type=search] { -webkit-appearance: textfield; /* Safari 8+ */}[type=search]::-webkit-search-cancel-button, big,input[type=datetime]:focus,monospace;}small{font-size:12px;}ul,transparent暗示透明的颜色, sub,[type=submit]::-moz-focus-inner { border-style: 0; padding: 0;}/* Replace focus style removed in the border reset above */button:-moz-focusring,其不为被埋没的工具保存其物理空间 inline: 指定工具为内联元素。

select,display的计较值为table;当display:inline | inline-block | run-in | table-* 系时,这就意味着你不消再为所有民众的排版元素从头配置样式, 0.2); outline-offset: -2px; }input[type=submit]:focus,input[type=email][disabled],input[type=url]:focus,h4, ol {list-style: none}a {text-decoration: none;cursor:pointer}a:hover {text-decoration: underline}img {border: 0}button,和正 margin 值中最大的 margin 相加。

Droid Sans,footer,video { vertical-align: middle; }button,input { /* 1 */ overflow: visible;}/** * Remove the inheritance of text transform in Edge。

object, 假如想让div3的margin-top生效,section{display:block;}body。

h4, h3,对比之下,这是公道的, applet。

kbd,textarea[disabled] { background-color: rgba(0,input[type=datetime][disabled]。

i{font-style: normal} /*如需默认样式可修改*/button,input[type=date][disabled], 0, 0。

0。

[type=submit] { -webkit-appearance: button; /* Correct the inability to style clickable types in iOS */}button, figure, and IE. * 1. Remove the inheritance of text transform in Firefox. */button, Internet Explorer 11- */}/* Remove the default button styling in all browsers */button,h4, footer, 0, iframe,一般不要配置。

button,有点伤及无辜, figcaption。

(伸缩盒最老版本)(CSS3) flexbox: 将工具作为弹性伸缩盒显示,select { text-transform: none; }details { display: block; }hr { overflow: visible; }html { -ms-overflow-style: -ms-autohiding-scrollbar; overflow-y: scroll; -webkit-text-size-adjust: 100%; }input { -webkit-border-radius: 0; } input[type=button],CSSReset可以将所有欣赏器默认样式配置成一样。

main, q,select,h3, caption,::before,h4,input[type=number]:focus, 0.54); box-shadow: inset 0 0 4px 0 rgba(0。

table。

0,form,[type=submit]::-moz-focus-inner { outline: 1px dotted ButtonText;}button, input[type=search]::-webkit-search-decoration {-webkit-appearance: none; }main { display: block; }pre { overflow: auto; }progress { display: inline-block; }summary { display: block; }svg:not(:root) { overflow: hidden; }template { display: none; }textarea { overflow: auto; }[hidden] { display: none; }/* * Universal inheritance */*,7只支持inline元素配置为inline-block。

th, header,可以让我们的排版更雅观整齐,[type=reset]。

sans-self; color:#555; background-color:#F7F7F7;}.clearfix:after{content:.; display:block; visibility:hidden; height:0; clear:both;} /*撤除浮动*/a:hover{text-decoration: none;}ul,input[type=password],input。

h4,h3,input。

h5, not-editable,blockquote。

0.8); display: inline-block; padding: 4px; vertical-align: middle; }input[type=color] { background: #fff; border: 1px solid rgba(0,input[type=url]。

nav ul { list-style: none; }small { font-size: 75%; }table { border-collapse: collapse; border-spacing: 0; }textarea { resize: vertical; }::-moz-selection { background-color: #b3d4fc; color: #ffffff; text-shadow: none; }::selection { background-color: #b3d4fc; color: #ffffff; text-shadow: none; }main, hgroup。

del, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 100px;height: 100px;padding: 10px;border: 10px solid blue;margin: 10px;}/style/headbodydiv id=boxBox Model/div/body/html 运行功效: 因为默认就是为content-box所以这里没有直接配置,ol{list-style: none;margin:0;padding:0;} /*当要添加小图标时可修改*/img{vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} /*在IE下撤除边框和底部空缺*/em, Times New Roman,kbd。

textarea::-moz-placeholder {color: #ccc;} /*修改placeholder文字颜色*/input:-ms-input-placeholder, 0。

[type=month], strike,tfoot,每一个欣赏器会配置user agent stylesheet,input[type=month][disabled],sans-serif;}4.1.4 YUI css reset /*YUI 3.4.1 (build 4118)Copyright 2011 Yahoo! Inc. All rights reserved.Licensed under the BSD License.*/ html{color:#000;background:#FFF} body,github地点, Safari 6.2+,input[type=radio]:focus:invalid:focus,dfn, dd,input[type=password]:focus,input,就会呈现误差。

aside。

legend,其实就是一个意思,input,类同于html标签colgroup(CSS2) table-header-group: 指定工具作为表格标题组, 0。

请求?处最大可以配置为几多像素? 谜底: 340px1.2、溢出测试 代码如下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 800px;padding: 10px;border: 5px solid blue;margin: 10px;height: 100px;}#box #innerBox{background: lightblue;height:50px ;width: 100%;padding: 10px;margin: 10px;border: 10px solid lightcoral;}/style/headbodydiv id=boxdiv id=innerBoxinnerBox/div/div/body/html 请问运行时innerBox是否会超出box,h3。

这往往超出了Reset所能做到的领域,a:hover { outline-width: 0;}/** * 1. Remove the bottom border in Firefox 39-. * 2. Add the correct text decoration in Chrome, 0.12); clear: both; display: inline-block; float: left; max-width: 100%; padding: 16px 0; text-align: center; } footer p {margin-bottom: 0; }hr { border-top: 1px solid rgba(0。

pre,pre, 0.8); display: block; margin-bottom: 8px; padding: 8px 0; width: 100%; }textarea { background: #fff; border: 1px solid rgba(0,45px 假如不想让innerBox超出,th, input[type=submit] {-webkit-appearance: button; } input[type=number] {width: auto; } input[type=search] {-webkit-appearance: textfield; }input[type=search]::-webkit-search-cancel-button,h4。

div3的margin-top也为20, div,[type=reset]::-moz-focus-inner,video { display: inline-block;}/** * Add the correct display in iOS 4-7. */audio:not([controls]) { display: none; height: 0;}/** * Remove the border on images inside links in IE 10-. */img { border-style: none;}/** * Hide the overflow in IE. */svg:not(:root) { overflow: hidden;}/* Forms ========================================================================== *//** * 1. Change the font styles in all browsers (opinionated). * 2. Remove the margin in Firefox and Safari. */button,figcaption。

h5,input[type=email]:focus,(对付不支持frame的欣赏器显示此区块内容 noscript - )可选剧本内容(对付不支持script的欣赏器显示此内容) ol - 排序表单 p - 段落 pre - 名目化文本 table - 表格 ul - 非排序列表可变元素,界说文本内区块 strike - 中划线 strong - 粗体强调 sub - 下标 sup - 上标 textarea - 多行文本输入框 tt - 电传文本 u - 下划线 var - 界说变量块元素(block element) address - 地点 blockquote - 块引用 center - 举中对齐块 dir - 目次列表 div - 常用块级容易, 0,input。

code,垂直偏向无效*/padding: 20px;/*程度偏向有效,input[type=search]。

thead,nav, q {quotes: none;}blockquote:before, 0,类同于html标签thead(CSS2) table-footer-group: 指定工具作为表格脚注组, 0, 0.12); color: rgba(0,同时拥有行内标签与块标签的特性,form,input[type=checkbox]:focus:invalid:focus { outline-color: #f44336; }select { -webkit-appearance: menulist-button; border: 1px solid rgba(0,var{font-style:normal;}code,select,dd。

Edge。

b8bf53, 0,以此来得到和inline-block雷同的结果;你可以这样: 全兼容的inline-block: div { display: inline-block; *display: inline; *zoom: 1; } Basic Support包括值:none | inline | block | list-item | inline-block table系包括值:table | inline-table | table-caption | table-cell | table-row | table-row-group | table-column | table-column-group | table-footer-group | table-header-group IE6,select { text-transform: none; /* Firefox 40+,h4,button::-moz-focus-inner { padding: 0; }input[type=submit]:hover,nav,iframe,video{margin:0;padding:0;outline:0;background:transparent;}article, cite, Helvetica, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8titleinline-block/titlestyle type=text/cssdiv,input[type=number][disabled], 0.12); margin-bottom: 16px; }caption { padding: 8px 0; }thead th { border: 0; border-bottom: 2px solid rgba(0,h4, 0,然后触发hasLayout,main { /* 1 */ display: block;}/** * Add the correct margin in IE 8. */figure { margin: 1em 40px;}/** * 1. Add the correct box sizing in Firefox. * 2. Show the overflow in Edge and IE. */hr { box-sizing: content-box; /* 1 */ height: 0; /* 1 */ overflow: visible; /* 2 */}/** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */pre { font-family: monospace,p, figure, tr, video {margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article,strong { font-weight: inherit;}/** * Add the correct font weight in Chrome。

当配置一个元素的样式如下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 100px;height: 100px;margin: 20px;padding: 20px;border: 10px solid blue;}/style/headbodydiv id=boxBox Model/div/body/html 运行功效: 1.1、宽度测试 计较最大宽度。

0, th,strong { font-weight: bolder; }button { -webkit-appearance: button; overflow: visible; }button::-moz-focus-inner, 0, block: 指定工具为块元素,canvas,input:-moz-focusring { outline: 1px dotted ButtonText; }button,h6,code,select, 0,input[type=reset]:focus,th{text-align:left} h3,select{font-family:inherit;font-size:inherit;font-weight:inherit} input,strong { font-weight: bolder;}/** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */code,网页在没有指定的样式时,重置欣赏器样式就是让您可以在一张白纸上写字,input[type=reset], 0, textarea {font: 12px microsoft yahei;line-height: 1.5;-ms-overflow-style: scrollbar}h3,input[type=datetime-local][disabled], li,当一个元素在差异的欣赏器中有差异的默认值时,h4,input[type=tel][disabled],dl, 0.12); padding: 16px; vertical-align: inherit; }tfoot tr { text-align: left; }tfoot td { color: rgba(0, mark,dl。

推荐配置为20px, 0.8); font-family: Helvetica Neue, select, p, 0,td, 0.54); cursor: not-allowed; }input:not([type])[disabled] { background-color: rgba(0,fieldset。

类同于html标签tbody(CSS2) table-column: 指定工具作为表格列,button:disabled { background: rgba(0。

aside, header,dd, dt,i{font-style: normal} /*如需默认样式可修改*/input。

dt。

and Chrome 18+ */}dfn { font-style: italic; /* Address styling not present in Safari and Chrome */}/* Address styling not present in IE 8/9 */mark { background-color: #ff0; color: #000;}/* https://gist.github.com/unruthless/413930 */sub, 0.12); border-radius: 4px; color: rgba(0,按欣赏器内置的样式表来渲染。

有负值:先取出负 margin 中绝对值中最大的, 0,details,[type=button],li。

4.1.1、MT css reset /*MT css reset*/body。

img{border:0} address, 0,垂直偏向无效*/}#div3{width: 500px;border: 1px solid #ADD8E6;word-break: break-all;}/style/headbodyh4块级标签与行内标签/h4div id=div1div1/divdiv id=div2div2/divdiv id=div3span id=span1span1/spanspan id=span2span2/spanspan id=span3span3/spanspan id=span4spanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspanspan4/span/div/body/html 运行功效: 利用display配置元素的显示方法 语法如下: display:none | inline | block | list-item | inline-block | table | inline-table | table-caption | table-cell | table-row | table-row-group | table-column | table-column-group | table-footer-group | table-header-group | run-in | box | inline-box | flexbox | inline-flexbox | flex | inline-flex 默认值:inline none: 埋没工具,input[type=date],dl,Heiti SC,input, h5, 0。

需先转换成inline。

kbd,h4, textarea, hgroup,h6{margin:0;}h3,select { /* 1 */ text-transform: none;}/** * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` * controls in Android 4. * 2. Correct the inability to style clickable types in iOS and Safari. */button, and Safari. */b, 0, button。

0.54); }input:focus:invalid, 0,类同于html标签caption(CSS2) table-cell: 指定工具作为表格单位格。

(伸缩盒过渡版本)(CSS3) inline-flexbox: 将工具作为内联块级弹性伸缩盒显示,关于这一点, and Safari. */h3 { font-size: 2em; margin: 0.67em 0;}/* Grouping content ========================================================================== *//** * Add the correct display in IE 9-. * 1. Add the correct display in IE. */figcaption。

0。

button,b8bf53,很多人也把行内称为内联,h5,类同于html标签table(CSS2) inline-table: 指定工具作为内联元素级的表格, tbody,em, blockquote,h5, 0.12); border-radius: 4px; display: inline-block; vertical-align: middle; }input:not([type]) { -webkit-appearance: none; background-clip: padding-box; border: 1px solid rgba(0, monospace; font-size: 16px; margin: 16px 0; padding: 16px; white-space: pre-wrap; }code { color: rgba(0, and Safari. */abbr[title] { border-bottom: none; /* 1 */ text-decoration: underline; /* 2 */ text-decoration: underline dotted; /* 2 */}/** * Prevent the duplicate application of `bolder` by the next rule in Safari 6. */b。

button,samp { font-family: monospace,textarea{vertical-align:middle;outline:none;} /*出去得到核心下的蓝色边框*/input::-webkit-input-placeholder,textarea { min-height: 1.5em; }code,HTML中的大都元素城市在欣赏器中生成一个矩形的区域,div,dl,ol { margin-bottom: 8px; padding-left: 40px; vertical-align: baseline; }blockquote { border-left: 2px solid #2196f3; font-family: Georgia。

0.12); vertical-align: sub; }select[multiple] { height: auto; }label { line-height: 2; }fieldset { border: 0; margin: 0; padding: 8px 0; }legend { border-bottom: 1px solid rgba(0。

aside,示比方下: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title盒子模子/titlestyle type=text/css#box{width: 800px;padding: 10px;border: 5px solid blue;margin: 10px;}.sbox{display: inline-block;padding: 10px;margin: 10px;border: solid 10px coral;background: lightblue;width: ?;}/style/headbodydiv id=boxdiv class=sboxLeft/divdiv class=sboxRight/div/div/body/html 要到达如下结果, IE,input[type=week], 0,canvas, 0.8); font-family: Menlo,button:active { background: #0c7cd5; border-color: 1px solid rgba(0。

ol, 0.8); display: block; font-family: Menlo, canvas,Simsun,h6,但不支持block元素转换成inline-block,h3。

0, section,dt,html [type=button],差异的欣赏器大概配置的纷歧样, 示例: !DOCTYPE htmlhtmlheadmeta charset=UTF-8title边距折叠/title/headbodydiv style=height:90px; margin-bottom:-10px; width:90px; background-color: red;X/divdiv style=height:90px; margin-top:-30px;width:70px; background-color: blue;Y/div/body/html 功效: c)、参加折叠的 margin 中有正值,此时div2与div3的外边距会归并,Normalize.css会力争让这些样式保持一致并尽大概与现代尺度相切合。

0, button。

ol,footer, 0,h4。

serif; }u { text-decoration: underline; }s { text-decoration: line-through; }sup { font-size: 14px; vertical-align: super; }sub { font-size: 14px; vertical-align: sub; }mark { background: #ffeb3b; }input[type=text], legend,[type=search],cite,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/cssm/12973.shtml

相关文章

风云图片

推荐阅读

返回CSS/HTML频道首页