CSS Tutorial from W3Schools
<!--[if !supportLists]-->1. <!--[endif]-->CSS Tutorial 1- Basic
<!--[if !supportLists]-->2. <!--[endif]-->CSS Tutoriasl 2- Advanced
<!--[if !supportLists]-->3. <!--[endif]-->CSS Examples
<!--[if !supportLists]-->4. <!--[endif]-->Quiz
<!--[if !supportLists]-->5. <!--[endif]-->References
CSS Tutorial 1- Basic
use CSS to control the style and layout of multiple Web pages all at once
http://www.w3schools.com/css/default.asp
1. Introduction to CSS
http://www.w3schools.com/css/css_intro.asp
Styles define how to display HTML elements
HTML tags were originally designed to define the content of a document.
Styles sheets define HOW HTML elements are to be displayed. Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in your Web, just by editing one single CSS document! CSS is a breakthrough in Web design because it allows developers to control the style and layout of multiple Web pages all at once. As a Web developer you can define a style for each HTML element and apply it to as many Web pages as you want. To make a global change, simply change the style, and all elements in the Web are updated automatically.
Multiple Styles Will Cascade Into One:
Style sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the <head> element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.
Cascading Order:
1. Browser default
2. External style sheet
3. Internal style sheet (inside the <head> tag)
4. Inline style (inside an HTML element) _highest priority
2. CSS Syntax
http://www.w3schools.com/css/css_syntax.asp
Syntax
Grouping
The class Selector
Add Styles to Elements with Particular Attributes
The id Selector
CSS Comments
更详细的细节参考以上链接。
3. CSS How To...
http://www.w3schools.com/css/css_howto.asp
three ways of inserting a style sheet
External Style Sheet
<link rel="stylesheet" type="text/css"
href="mystyle.css" />
An external style sheet is ideal when the style is applied to many pages.
Internal Style Sheet
An internal style sheet should be used when a single document has a unique style.
<head>
<style type="text/css">
hr {color: sienna}
p {margin-left: 20px}
body {background-image: url("images/back40.gif")}
</style>
</head>
Inline Styles
An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly, such as when a style is to be applied to a single occurrence of an element.
<p style="color: sienna; margin-left: 20px">
This is a paragraph
</p>
PS:Multiple Style Sheets will be affected according to CSS order priority.
4. CSS properties
1) CSS Background
The CSS background properties define the background effects of an element.
http://www.w3schools.com/css/css_background.asp
2) CSS Text
The CSS text properties define the appearance of text.
http://www.w3schools.com/css/css_text.asp
3) CSS Font
The CSS font properties define the font in text.
http://www.w3schools.com/css/css_font.asp
4) CSS Border
The CSS border properties define the borders around an element.
http://www.w3schools.com/css/css_border.asp
5) CSS Outlines
The CSS outline properties is used to draw a line around an element, outside the border edge.
(some of them does not work in IE…)
http://www.w3schools.com/css/css_outline.asp
6) CSS Margin
The CSS margin properties define the space around elements.
http://www.w3schools.com/css/css_margin.asp
CSS Padding
The CSS padding properties define the space between the element border and the element content.
http://www.w3schools.com/css/css_padding.asp
7) CSS List
The CSS list properties allow you to place the list-item marker, change between different list-item markers, or set an image as the list-item marker.
http://www.w3schools.com/css/css_list.asp
8) CSS Table
The CSS table properties allow you to set the layout of a table.
http://www.w3schools.com/css/css_table.asp
CSS Tutorial 2- Advanced
<!--[if !supportLists]-->1. <!--[endif]-->CSS Dimension
The CSS dimension properties allow you to control the height and width of an element. It also allows you to increase the space between two lines.
http://www.w3schools.com/css/css_dimension.asp
<!--[if !supportLists]-->2. <!--[endif]-->用于页面布局
CSS Classification (VIP)
The CSS classification properties allow you to specify how and where to display an element.
http://www.w3schools.com/css/css_classification.asp
CSS Positioning
The CSS positioning properties allows you to position an element.
http://www.w3schools.com/css/css_positioning.asp
3.
CSS Pseudo-classes (a:active, a:hover, a:link, a:link, a:visited等,但是有些在IE下不work,比如div再FF下可以定义其:hover的style,实现将鼠标移到div上面即载入该style)
CSS pseudo-classes are used to add special effects to some selectors.
http://www.w3schools.com/css/css_pseudo_classes.asp
CSS Pseudo-elements: (比如首字母大写等等)
CSS pseudo-elements are used to add special effects to some selectors.
http://www.w3schools.com/css/css_pseudo_elements.asp
<!--[if !supportLists]-->4. <!--[endif]-->CSS Image Gallery
CSS can be used to create an image gallery.
http://www.w3schools.com/css/css_image_gallery.asp
CSS Image Opacity / Transparency(图片透明 | So Cool )
Creating transparent images with CSS is easy.
http://www.w3schools.com/css/css_image_transparency.asp
<!--[if !supportLists]-->5. <!--[endif]-->CSS2 Media Types
Media Types allow you to specify how documents will be presented in different media. The document can be displayed differently on the screen, on the paper, with an aural browser, etc.
http://www.w3schools.com/css/css_mediatypes.asp
CSS Summary:
You have learned how to use CSS to add backgrounds, format text, add and format borders, and specify padding and margins of elements.
You have also learned how to position an element, control the visibility and size of an element, set the shape of an element, place an element behind another, and to add special effects to some selectors, like links.
http://www.w3schools.com/css/css_summary.asp
What’s next: JavaScript
CSS Example
http://www.w3schools.com/css/css_examples.asp
CSS Quiz
padding attribute is not allowed to be negative.
CSS Reference
CSS Reference:
http://www.w3schools.com/css/css_reference.asp
CSS2 Print Reference
http://www.w3schools.com/css/css_ref_print.asp
CSS2 Aural Reference
http://www.w3schools.com/css/css_ref_aural.asp
CSS Units
http://www.w3schools.com/css/css_units.asp
CSS Colors
http://www.w3schools.com/css/css_colors.asp