Add table element normalization. Add default font-size and line-height to <body>. Set font-family on <body> and form elements to improve consistency. Set font-size:100% on form elements so they inherit body's font-size.

This commit is contained in:
Nicolas Gallagher 2011-05-17 09:27:55 -07:00
parent 4cf8cf3e6e
commit a27246fcab

52
normalize.css vendored
View File

@ -51,11 +51,28 @@ html {
} }
/* /*
* Remove margin from <body> element * 1. Define the base font-size of choice; set in % or em to retain text resizing in IE6/7
* 2. Define the base line-height of choice.
* 3. Remove margin from <body> element
*/ */
body { body {
margin: 0; font-size: 100%; /* 1 */
line-height: normal; /* 2 */
margin: 0; /* 3 */
}
/*
* Define the base font-family and text color for <body> and form elements
* Fixes font-family inconsistency between <textarea> and other set form elements.
*/
body,
input,
button,
textarea,
select {
font-family: sans-serif;
} }
/* /*
@ -271,17 +288,19 @@ legend {
} }
/* /*
* 1. Remove margin from form elements * 1. Define font-size as equal to <body> font-size
* Fixes margin displayed oddly in C10 S5 * 2. Remove margin from form elements
* 2. Define consistent vertical alignment in all browsers * Fixes different margins set in C10 S5 FF3/4
* 3. Define consistent vertical alignment in all browsers
*/ */
button, button,
input, input,
select, select,
textarea { textarea {
margin: 0; font-size: 100%; /* 1 */
vertical-align: baseline; margin: 0; /* 2 */
vertical-align: baseline; /* 3 */
} }
/* /*
@ -355,3 +374,22 @@ textarea {
-webkit-box-sizing: content-box; -webkit-box-sizing: content-box;
box-sizing: content-box; box-sizing: content-box;
} }
/* ............................................................................................................. Table elements */
/*
* Remove most spacing between table cells
* Consistent vertical and horizontal alignment
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
th,
td {
padding: 0;
text-align: left;
vertical-align: middle;
}