search
HomeWeb Front-endH5 TutorialSample code for combining Html5's Reset and Base styles

结合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;
}

The above is the detailed content of Sample code for combining Html5's Reset and Base styles. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
H5: New Features and Capabilities for Web DevelopmentH5: New Features and Capabilities for Web DevelopmentApr 29, 2025 am 12:07 AM

H5 brings a number of new functions and capabilities, greatly improving the interactivity and development efficiency of web pages. 1. Semantic tags such as enhance SEO. 2. Multimedia support simplifies audio and video playback through and tags. 3. Canvas drawing provides dynamic graphics drawing tools. 4. Local storage simplifies data storage through localStorage and sessionStorage. 5. The geolocation API facilitates the development of location-based services.

H5: Key Improvements in HTML5H5: Key Improvements in HTML5Apr 28, 2025 am 12:26 AM

HTML5 brings five key improvements: 1. Semantic tags improve code clarity and SEO effects; 2. Multimedia support simplifies video and audio embedding; 3. Form enhancement simplifies verification; 4. Offline and local storage improves user experience; 5. Canvas and graphics functions enhance the visualization of web pages.

HTML5: The Standard and its Impact on Web DevelopmentHTML5: The Standard and its Impact on Web DevelopmentApr 27, 2025 am 12:12 AM

The core features of HTML5 include semantic tags, multimedia support, offline storage and local storage, and form enhancement. 1. Semantic tags such as, etc. to improve code readability and SEO effect. 2. Simplify multimedia embedding with labels. 3. Offline storage and local storage such as ApplicationCache and LocalStorage support network-free operation and data storage. 4. Form enhancement introduces new input types and verification properties to simplify processing and verification.

H5 Code Examples: Practical Applications and TutorialsH5 Code Examples: Practical Applications and TutorialsApr 25, 2025 am 12:10 AM

H5 provides a variety of new features and functions, greatly enhancing the capabilities of front-end development. 1. Multimedia support: embed media through and elements, no plug-ins are required. 2. Canvas: Use elements to dynamically render 2D graphics and animations. 3. Local storage: implement persistent data storage through localStorage and sessionStorage to improve user experience.

The Connection Between H5 and HTML5: Similarities and DifferencesThe Connection Between H5 and HTML5: Similarities and DifferencesApr 24, 2025 am 12:01 AM

H5 and HTML5 are different concepts: HTML5 is a version of HTML, containing new elements and APIs; H5 is a mobile application development framework based on HTML5. HTML5 parses and renders code through the browser, while H5 applications need to run containers and interact with native code through JavaScript.

The Building Blocks of H5 Code: Key Elements and Their PurposeThe Building Blocks of H5 Code: Key Elements and Their PurposeApr 23, 2025 am 12:09 AM

Key elements of HTML5 include,,,,,, etc., which are used to build modern web pages. 1. Define the head content, 2. Used to navigate the link, 3. Represent the content of independent articles, 4. Organize the page content, 5. Display the sidebar content, 6. Define the footer, these elements enhance the structure and functionality of the web page.

HTML5 and H5: Understanding the Common UsageHTML5 and H5: Understanding the Common UsageApr 22, 2025 am 12:01 AM

There is no difference between HTML5 and H5, which is the abbreviation of HTML5. 1.HTML5 is the fifth version of HTML, which enhances the multimedia and interactive functions of web pages. 2.H5 is often used to refer to HTML5-based mobile web pages or applications, and is suitable for various mobile devices.

HTML5: The Building Blocks of the Modern Web (H5)HTML5: The Building Blocks of the Modern Web (H5)Apr 21, 2025 am 12:05 AM

HTML5 is the latest version of the Hypertext Markup Language, standardized by W3C. HTML5 introduces new semantic tags, multimedia support and form enhancements, improving web structure, user experience and SEO effects. HTML5 introduces new semantic tags, such as, ,, etc., to make the web page structure clearer and the SEO effect better. HTML5 supports multimedia elements and no third-party plug-ins are required, improving user experience and loading speed. HTML5 enhances form functions and introduces new input types such as, etc., which improves user experience and form verification efficiency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor