As a web developer, it is also important to have the necessary foreground technology, especially when encountering some practical problems. Here are a few examples to illustrate:
Add a class to a P tag, but some properties in that class do not work after execution. The Firebug view shows that the properties that are not working are overwritten. This time suddenly aware of the CSS selector priorit
, often use CSS style display less than 12px text, so that Google Browser can not display the smaller text set. But there is a solution.3, to solve the required CSS code-TOPAdd a Google browser-specific kernel attribute style to the HTML or body (or you can add a CSS selector if you need to set a small text font object
This article mainly introduces the CSS selector grouping related data, the need for friends can refer to the following
Selector grouping
Suppose you want H2 elements and paragraphs to be gray. The easiest way to achieve this is to use the following statement:
h2, p {color:gray;}
A rule is defined by placing the H2 and P selectors on the left side of the rule and
); E:last-child: The second-to-last child element of the parent element E; E:first-of-type: Same as: Nth-of-type (1); E:last-of-type: Same as: Nth-last-of-type (1); E:only-child: The only child element in the parent element, E; E:only-of-type: The only element in the parent element that has that type E; E:empty: element without child element, no child element including text node; E:lang (en): an element with a language expressed using a double-letter abbreviation (EN);
CSS selector syntaxCSS stylesheets are composed of selectors and life blocks. The declaration block has a property name, a property value, a colon separated by the middle, and a semicolon ending.Selector Group actionsYou can combine several selectors into a piece to quickly select the elements of the operation. For example, h1,h2,h3,h4,h5,h6{color:red;}* Wildcard select
CSS is one of the most powerful tools available to web designers. Using it, we can change the interface of a website within several minutes without changing the tab of the page. But while in fact, each of us realizes that it is useful, CSS selectors are far from exploiting their potential, sometimes we tend to use too many useless classes, IDs, Div, and span to make our HTML messy.
The best way to avoid spr
You may have mastered the basic css selectors such as id, class, and background selector. But this is far from the whole of css. The following describes the 30 most commonly used selectors in css parsing for your system, including our biggest browser compatibility issue. Only by mastering them can we truly appreciate t
I. CSS Selector1. type, class, and Id selector: element. Class element # ID2. Group selector: Use a comma3. Descendant selector: Use a space4. Child selector: greater than ID5. First-Child selector: First-child6. sibling
Note: "proficient in css" Chapter 2nd selector, comment, "proficient in css" Chapter 2ndChapter 2 selector, comment
1. You need to know the commonly used selectors (id selector, class selector, type
-child: The only child element in the parent element, E;E:only-of-type: The only element in the parent element that has that type E;E:empty: element without child element, no child element including text node;E:lang (en): an element with a language expressed using a double-letter abbreviation (EN);E:not (Exception): The selector selects elements that do not match the selectors in parentheses:p:not(.info) {font-size:12px;} //匹配所有class值不为info的p元素5. Pseu
element in the parent element, E;E:only-of-type: The only element in the parent element that has that type E;E:empty: element without child element, no child element including text node;E:lang (en): an element with a language expressed using a double-letter abbreviation (EN);E:not (Exception): The selector selects elements that do not match the selectors in parentheses:p:not(.info) {font-size:12px;} //匹配所有class值不为info的p元素5. Pseudo-ElementsPseudo-elem
See also: http://www.divcss5.com/css-hack/c263.shtml
CSS Google browser css Chrome css Safari browser to identify CSS hack
We know and will use the difference between CSS ie Firefox bro
be n, can not be substituted with other letters.(3),: Nth-child (Odd) selected an odd-numbered item, while using: Nth-last-child (Odd) selected an even entry7, negation pseudo class selector
Selector Selector
Function description
E:not (F)
Matches all e elements except the element f
8, Property
What this article brings to you is about the use of CSS property selectors. CSS Property Selector usage Introduction (code), there is a certain reference value, the need for friends can refer to, I hope to help you.
One, existence and value attribute selectors
1. Existence and Value attribute Selector
/* Existe
, and it actually puts width as the minimum width. In order for this command to work on IE, you can put a div under the body tag and then assign a class to the div: then the CSS is designed like this:#container {min-width:600px; Width:expression (Document.body.clientWidth 7 Clear Float. hackbox{display:table;//Display the object as a block-element-level table} or. hackbox{Clear:both;} or join: After (pseudo-object), set what happens after the object,
One, Tag SelectorSecond, category selectorThird, ID selectorThe selector (selector) is a very important concept in CSS, and all markup styles in the HTML language are controlled by different CSS selectors. Users only need to select different HTML tags through the selector, a
CSS Selector PrecedencePriority order:1,! Important (IE6 does not support this property) 2, HTML element tag added style= ""(CSS difficult to manage, not recommended) 3, one or more ID selectorsExample: #top {margin:0;}4, one or more class selectors (including attributes, Pseudo-class selectors)example:. outer{} [data-job= "Frontend"]{} a:active{}5. Tag Selectore
The five most common types of CSS selectorsAccurate and concise use of CSS selectors will achieve very good results. We don't have to define the class or ID for each element throughout, and with the right organization, you can do the same thing in the simplest way possible. In the actual work, the most commonly used selectors have the following five categories:First, Tag selector:As implies, Tag
A lot of people think
CSSEspecially simple, but actually really write well
CSSNot easy,
CSSEach point is actually a lot of content, take the selector,
CSSSelectors can be divided into five categories:
Element Selector
Relationship Selector
Property Selector
Pseudo class
Learn the Web notes, course: http://www.imooc.com/code/20241.css Selector
Sub-selector: parent>child
A child selector refers to the first child element in the range that selects the parent. Both parent and child are pseudo-code here. Can be a class with a. classname, or it can be a label ul>li, or an ID #pid > #
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.