찾다
웹 프론트엔드H5 튜토리얼Html5의 Reset 및 Base 스타일을 결합하기 위한 샘플 코드

结合Normalize CSS,Reset CSS, Base CSS, Html5 Reset Css整理了一份新的样式,我这里暂把他叫做HTML5 的Reset CSS 和Base CSS的结合。下面把相应的代码贴出来以供大家一起探讨。

/**
*Remove Spacing
*/body,dl,dd,ul,ol,figure ,h1,h2,h3,h4,h5,h6,p,pre,blockquote,
form ,fieldset,legend ,input,button,select,textarea {  margin: 0;  padding: 0;
}/*
 * Add block display for HTML5 elements
 * Corrects block display not defined in IE6/7/8/9 & FF3
 */article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {  display: block;
}/* =============================================================================
   Typography
   ========================================================================== *//*
 * Add bottom border
 * Corrects styling not present in IE7/8/9 S5 Chrome
 */abbr[title],
dfn[title] {  border-bottom: 1px dotted;  cursor:help;
}/*
 * Define font family as monospace
 * Corrects font family set oddly in IE6 S5 C10
 * en.wikipedia.org/wiki/User:Davidgothberg/Test59
 */pre,
code,
kbd,
samp { font-family: monospace, sans-serif;   _font-family: 'Courier New', monospace, sans-serif; font-size: 1em;
}/*
 * Add line wrapping
 * Improves readability of pre-formatted text in all browsers
 */pre {  white-space: pre;/*CSS2*/
  white-space: pre-wrap;/*CSS2.1*/
  white-space: pre-line;/*CSS3*/
  word-wrap: break-word;/*IE*/}/*
 * Remove quotes
 * 1. Addresses CSS quotes not supported in IE6/7
 * 2. Addresses quote attributes not supported in S4
 */blockquote,
q {  quotes: none;
}
 
blockquote:before,
blockquote:after,
q:before,
q:after {  content: '';  content: none;
}/*
 * Define font size
 * Improves appearance in all browsers
 */small {  font-size: 75%;
}/*
 * Define font size and alignment
 * Improves appearance without affecting line-height in all browsers
 * gist.github.com/413930
 */sub,
sup {  font-size: 75%;  line-height: 0;  position: relative;  vertical-align: baseline;
}
 
sup {  top: -0.5em;
}
 
sub {  bottom: -0.25em;
}/*Clear floats 
 *The Magnificent CLEARFIX:Updated fo prevent margin-collapsing on child elements 
 */.clearfix:before,
.clearfix:after {   content:"\0020";   display: block;   height: 0;   visibility: hidden;
}
 
.clearfix {  zoom: 1;/*IE<8*/}
 
.clearfix:after {  clear: both;
}
* html .clearfix { 
  zoom: 1; /* IE6 */} 
*:first-child+html .clearfix { 
  zoom: 1; /* IE7 */} 
 
/*
 * Add inline-block display for HTML5 elements
 * Corrects inline-block display not defined in IE6/7/8/9 & FF3
 */audio[controls],
canvas,
video { display: inline-block;
 *display: inline;
 *zoom: 1;
}
 
html { font-size: 100.01%;/*To Prevent bugs in IE and Opera*/
 height: 100%;/*Using height 100% on html and body allows to style containers with a 100% height*/
 overflow-y: scroll;/*The overflow declaration is to make sure there is a gutter for the scollbar in all browsers regardless of content*/
 cursor: default; /* Add normal cursor  Improves visual focus of page during mouse use in all browsers */
 overflow-y: scroll; /* Add vertical scrollbar  Keeps page centered in all browsers regardless of content height */
 -webkit-tap-highlight-color: transparent; /* Add vertical scrollbar  Keeps page centered in all browsers regardless of content height */
 -ms-text-size-adjust: 100%; /* Define maximum text display as 100% to document Corrects text displayed oddly after orientation change in handheld browsers */
 -webkit-text-size-adjust: 100%; /* Define maximum text display as 100% to document Corrects text displayed oddly after orientation change in handheld browsers */}
 
body { background-color: #fff;/*Not all browsers set white as the default background color*/
 color: #444;/*#444 looks better than black*/
 height: 100%;
}
 
body,
button
input,
select,
textarea { font: 12px/1.5 sans-serif;
}
 
img,fieldset {  border: 0 none; /*Remove border   Improves readability when inside <a> element in all browsers*/}
 
img {  vertical-align: top;  -ms-interpolation-mode: bicubic; /*Add high quality bicubic image resampling Improves visual appearance when scaled in IE7*/}/* =============================================================================
   Links
   ========================================================================== *//*
 * Remove outline
 * Improves appearance when active or hovered in all browsers
 * people.opera.com/patrickl/experiments/keyboard/test
 */a,
a:active,
a:hover {  outline: none;
}/*
 * Define outline as thin dotted
 * Improves appearance displayed oddly in C10
*/a:focus { outline: thin dotted;
}
 
a,
a:link { color: #0000EE; text-decoration: none;
}
 
a:hover { text-decoration: underline;
}
a:visited {  text-decoration: none;  color: #551A8B;
}/*Hide only visually,but have it available for screenreaders*/.hidden {   border: 0 !important;   clip: rect(1px 1px 1px 1px);/*IE<8*/
   clip: rect(1px,1px,1px,1px);   height: 1px !important;   margin: -1px;   overflow: hidden;   padding: 0 !important;   position: absolute !important;   width: 1px;
}/* =============================================================================
   Lists
   ========================================================================== */dd {  margin: 0 0 0 40px;
}
 
nav ul,
nav ol {  list-style: none;
}/* =============================================================================
   Forms
   ========================================================================== */form {  overflow: visible;
}
 
fieldset {  line-height: 1;/*line height helps to set the vertical alignment of radio buttons and check boxes*/}/*
 * Add negative left margin
 * Corrects alignment displayed oddly in IE6/7
 */legend {
  *margin-left: -7px;
}/*
 * Define consistent vertical alignment display in all browsers
 */button,
input,
select,
textarea {  vertical-align: baseline; 
  *vertical-align: middle; 
}/*
 * 1. Define line-height as normal
 *    Corrects FF3/4 setting it using !important in the UA stylesheet
 * 2. Make visible overflow
 *    Fixes spacing displayed oddly in IE6/7
 */button,
input {  line-height: normal; /* 1 */
  *overflow: visible;  /* 2 */}/*
 * 1. Display hand cursor for clickable form elements
 *    Improves usability and consistency of cursor style between image-type <input /> and others
 * 2. Define appearance for clickable form elements
 *    Corrects inability to style clickable <input /> types in iOS
 */button,
input[type="button"], 
input[type="reset"], 
input[type="submit"],
.form-btn,
.btn {  cursor: pointer; /* 1 */
  -webkit-appearance: button; /* 2 */}/*
 * Define box sizing
 * Addresses box sizing set to content-box in IE8/9
 */input[type="checkbox"],
input[type="radio"] {  box-sizing: border-box;
}
 
input[type="checkbox"] {  vertical-align: bottom;/*Vertical alignment of checkboxes*/
  *vertical-align: baseline;/*IE7*/}
 
input[type="radio"] {  vertical-align: text-bottom;/*Vertical alignment of radio buttons*/}
 
input {  _vertical-align: text-bottom;/*Vertical alignment of input fields for IE6*/}/*
 * Define box sizing and appearance
 * Addresses box sizing set to border-box in S5 Chrome (include -moz to future-proof)
 * Addresses appearance set to searchfield in S5 Chrome
 */input[type="search"] {  -webkit-appearance: textfield;  -moz-box-sizing: content-box;  -webkit-box-sizing: content-box;  box-sizing: content-box;
}/*
 * Remove inner padding and border
 * Fixes appearance displayed oddly in FF3/4
 * www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
 */button::-moz-focus-inner,
input::-moz-focus-inner {  border: 0;  padding: 0;
}/*
 * 1. Disable default vertical scrollbar
 *    Corrects scrollbar displayed oddly in IE6/7/8/9
 * 2. Add top vertical alignment
 *    Improves readability and aligment in all browsers
 */textarea {  overflow: auto; /* 1 */
  vertical-align: top; /* 2 */}
 
input[type="email"],
input[type="text"],
input[type="password"],
input[type="select"],
input[type="search"],
input[type="file"],
textarea,
select {  -moz-border-radius: 3px;  -webkit-border-radius: 3px;  border-radius: 3px;  border: 1px solid #7F9DB9;
}
 
input:focus,
textarea:focus,
select:focus {  outline-width: 0;/*No outline border for Safary*/}
 
 
select {  background-color: transparent;/*In Webkit/Mac, select fails to inherit color,font-*,etc if there is no other styling like background for example(border will do to)*/}
 
label {  font-weight: normal;
}
 
label.required:after { 
  content:"*";  color:red;  font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif;
}
 
button,
input[type="submit"],
input[type="reset"],
input[type="button"],
.form-btn {  width: auto;
  *width: 1;  overflow: visible;
}/* =============================================================================
   Tables
   ========================================================================== *//* 
 * Remove spacing between table cells
 * Improves vertical and horizontal alignment in all browsers
 */table {  border-collapse: collapse;  border-spacing: 0;
}
 
th,
td {  padding: 0;  text-align: left;  vertical-align: middle;
}/*
 *Header
 */h1 {  font-size: 2em;
}
 
h2 {  font-size: 1.5em;
}
 
h3 {  font-size: 1.17em;
}
 
h4 {  font-size: 1em;
}
 
h5 {  font-size: 0.83em;
}
 
h6 {  font-size: 0.67em;
} 
 
p {  margin-bottom: 4px;
}

위 내용은 Html5의 Reset 및 Base 스타일을 결합하기 위한 샘플 코드의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
html5的div一行可以放两个吗html5的div一行可以放两个吗Apr 25, 2022 pm 05:32 PM

html5的div元素默认一行不可以放两个。div是一个块级元素,一个元素会独占一行,两个div默认无法在同一行显示;但可以通过给div元素添加“display:inline;”样式,将其转为行内元素,就可以实现多个div在同一行显示了。

html5中列表和表格的区别是什么html5中列表和表格的区别是什么Apr 28, 2022 pm 01:58 PM

html5中列表和表格的区别:1、表格主要是用于显示数据的,而列表主要是用于给数据进行布局;2、表格是使用table标签配合tr、td、th等标签进行定义的,列表是利用li标签配合ol、ul等标签进行定义的。

html5怎么让头和尾固定不动html5怎么让头和尾固定不动Apr 25, 2022 pm 02:30 PM

固定方法:1、使用header标签定义文档头部内容,并添加“position:fixed;top:0;”样式让其固定不动;2、使用footer标签定义尾部内容,并添加“position: fixed;bottom: 0;”样式让其固定不动。

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5中不支持的标签有哪些html5中不支持的标签有哪些Mar 17, 2022 pm 05:43 PM

html5中不支持的标签有:1、acronym,用于定义首字母缩写,可用abbr替代;2、basefont,可利用css样式替代;3、applet,可用object替代;4、dir,定义目录列表,可用ul替代;5、big,定义大号文本等等。

html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

html5是什么意思html5是什么意思Apr 26, 2021 pm 03:02 PM

html5是指超文本标记语言(HTML)的第五次重大修改,即第5代HTML。HTML5是Web中核心语言HTML的规范,用户使用任何手段进行网页浏览时看到的内容原本都是HTML格式的,在浏览器中通过一些技术处理将其转换成为了可识别的信息。HTML5由不同的技术构成,其在互联网中得到了非常广泛的应用,提供更多增强网络应用的标准机。

Html5怎么取消td边框Html5怎么取消td边框May 18, 2022 pm 06:57 PM

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

DVWA

DVWA

DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

SublimeText3 영어 버전

SublimeText3 영어 버전

권장 사항: Win 버전, 코드 프롬프트 지원!

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구