CSS
Round-trip time (RTT) is the time it takes for a client to send a request and the server to send a response over the network, not including the time required for data transfer.
Combining external stylesheets into 1 or 2 cuts down on RTTs and delays in downloading other resources. Combining them into fewer output files can reduce latency.
Correctly ordering external stylesheets and scripts enables better parallelization of downloads and speeds up browser rendering time.
w3.org selectorsCSS is the presentation language. HTML and CSS are two of the core technologies for building web pages. HTML for structured content and CSS for layout and presentation.
h1 { color:#000; } the heading is black
h6 { color:#666; font-size:1em; } subheadings are gray
#aside h6 { color:#fc0; } subheadings in "aside" are gold
p { color:#000; } paragraph text is black
selector declaration
selector property:value
chain of contextual selectors: #content ul li a { color:#000; }
E > F an F element child of an E element (child combinator)
E + F an F element immediately preceded by an E element (adjacent sibling combinator)
#content { background:#ccc url(/img/cool.png) 0 0 no-repeat fixed; }
background-color: #ccc;
background-image: url(/img/cool.png);
background-position: 0 0;
background-repeat: no-repeat;
background-attachment: fixed;
the background-position property sets the starting position of a background image.
background-position: 0 0;
background-position: left top;
background-position: 0% 0%
If only one keyword is specified, then the second value is "center", note default value is 0% 0%
.bac { background:#fff url(/img/grad.png) left top repeat-x; }
.bac { background:transparent url(img/grad.png) center top repeat-y fixed; }