Mastering CSS: Advanced Web Standards Solutions (2nd Edition)
Jump to: Navigation, Search
- Cascading importance: (that is, user !important can override inline style)
- !important, user>author, and finally browser/user agent
- Calculation of rule specificity (order): a, b, c, d If they are the same, the one defined later takes precedence
- If it is inline style, a =1
- b=number of ID selectors (#id)
- c=number of class, pseudo-class, attribute selectors
- d=type, pseudo- Number of element selectors
- => How to manage the order of rules in a large website with complex content? ? ?
- @import is slower than link?
- p41 (vertical) margin overlay (=max(upper's margin-bottom, down's margin-top))
- Elements nested and included, and empty elements will be overlaid
- only for the block box of ordinary document flow, inline, float, position:absolute will not overlap
- inline: setting the height and width has no effect, line-height
- = > inline-block
- Cannot directly apply styles to {anonymous block, text line box}
- position: relative: you can specify left and top "relative to" the original Position, the element still occupies the original space
- position:absolute: The element does not occupy the document flow space (this is equivalent to raising its z-index?)
- Positioned relative to its nearest ancestor element (It can be seen from this that CSS positions ancestor elements first and descendant elements later?)
- position:fixed: relative to viewport (generally used for user comments)
- position:float: can be moved left and right (out of the document flow), until it hits the containing box or another floating box
- If the containing block (containing block?) cannot be horizontal Accommodating all elements, other float elements will move down
- Text elements will be affected by float, causing an effect similar to WORD's 'text wrapping'
- To prevent this, clear these text lines float.
- You can use an empty element clear:both to make the parent container contain floating elements. (You can also use the float container directly, but this will affect the next element)
- .clearFloat:after { content: "."; height:0; visibility:hidden; display:block; clear:both; }
- 'Holly hack' in IE 6-
- p56 created using background image Bullets
- p65 The rounded corner box is easy to handle in CSS 3. Skip the various tricks in the CSS 2.1 era
- 9-segmented border-image: url(user-corner. gif) 25% 25% 25% 25% / 25px round round;
- CSS shadow: box-shadow
- CSS parallax: background-position: 20% 0;
- Image replacement (CSS 2.1):
- FIR: display:none of text causing unsuitability for screen readers
- Phark: use text-indent:-5000px; for The case of turning off the image but turning on CSS is invalid
- sIFR (JS Flash)
- p87 CSS 3 allows: target pseudo-class? (Well, there is no problem of information leakage in this way)
- External link style (common in Wiki)
- p92 The text is always vertically centered in the line box (??), set line-height That’s it. Using height will cause the text to not be vertically centered, so additional padding must be set
- CSS Tooltip: How about the simplest title attribute?
- p105 Highlight the current page in the navigation bar : Use 2 IDs, one of which is applied to the body element for combined matching (in this way, the background of the navigation bar does not need special processing...) Cool!
- p114 The old version of IE does not support using :hover on non-anchor elements. You can use JS or .htc behavior files to enable this function
- CSS image mapping: wrap the img with a div, Set its size equal to the image and position:relative; then position each li element relative to the div, and use :hover to display the border line. . .
- p129 Long-distance flip: It is actually very simple. Let the anchor element wrap a div/span/li, and then use absolute positioning to move these containing elements to other positions on the page. Just set the :hover of the anchor element. .
- p136 2 models of table element border: collapse|separate
- Form element
- fieldset: block title (Group Panel/Box)
- label 2 ways to use: nesting contains input; use for attribute to associate input (id)
- p153 'The basis of all CSS layouts are 3 basic concepts: positioning, floating, margin manipulate. '
- IE 6 - does not support margin:auto; Fortunately, IE misinterprets text-align:center; as centering everything, not just the text (...)
- p159 In standards-compliant browsers, if the content of an element is too large, it will simply extend outside the box. However, IE expands the entire element (...-_-)
- 3-column layout: broken down into 2 nested 2-column layout? ? ?
- p164 flow layout: min-width! (Haha, I think an online CSS exam system can be developed. The question is about layout accurate to px. JS is required to check whether the effect is correct... ha)
- p166 Flexible layout: relative to the font size (em units) layout (not necessary for browsers that support page scaling)
- body{font-size:62.5%;} only sets the width of the container in em units, the internal width still uses %
- p170 faux column (omitted)
- bugs and bug fixes
- IE's 'own layout' (hasLayout)
- Setting the following attributes will cause the element to have layout: float, display:inline-block;, width/height, zoom, writing-mode:tb-rl; added in IE7: overflow, min-width: any value, max- width: any value except none
- For example: in IE, text paragraphs have layout, and there will be no effect of surrounding float elements
- Another example: in IE 6-, elements with layout will be wrong Expands to fit content size...
- Hacks and filters (omitted)
- Common bugs on IE 6-:
- Any float Doubling the element's margin? ? ? Change to display:inline;
- 3px text offset
- Repeat last few characters of last element of a series of floated elements: remove comment (..!)
- * 'peek-a-boo' bug with IE6
- * Absolute positioning (o, i c, shit) in relative containers: .rel-container{height:1%;}
- Case Study
- Roma Italia
- Cufon? Display html with the selected font, without any images or @font-face (???): the EULA for the selected font must allow font embedding on the web
- Climb the Mountains
- :first-child
- Combined class
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