Note is divided into two parts: Today is the CSS selector, and later there is a part of the XPath selector. Today's note contains 44 selectors, basically covering all the rules of CSS 2 and CSS 3.
==================================
CSS
Body {
Font-size:0.8em;
Color:navy;
}
Above means setting the Font-size font size and color font for the body selector.
So basically, when it works with HTML pages, the text color between the body tag (the contents of the entire window) is Navy font size is 0.8ems.
Length and percentage
CSS has many property values to specify units, but some of the basic units are used on some attributes, before they
One type of CSS in particular makes me cringe every time I see it; Poor selector intent. Poor selector Intent means carpet bombed selectors whose key selector has the to too broad a reach; A selector like as opposed to one .header ul{} .main-nav{} , .widget h2{} instead of;
are descendants of the e element, separated by a space between E and F
7.
E > F
child element Selector, matching all e element's child elements F
8.
E + F
Adjacent element selector, matching all sibling elements immediately following the E element f
Instance:
div p {color: #f00;}
#nav li {display:inline;}
#nav a {font-weight:bold
Often there are tag selectors, class selectors, ID selectors and so on, in fact there are many, in the next article for you to introduce in detail the types of these selectors and their use
First of all, what are the main starters?1. Tag Selector (for example: Body,p,p,ul,li)2. Class selector (e.g.: class= "Head", class= "Head_logo")3.ID selector (for example: i
CSS basics 6: id SelectorExample of an id Selector
The id selector allows you to specify styles in a way independent of document elements. In some ways, the id selector is similar to a class selector, but there are some
Important differences.
SyntaxFirst, there is a # sign i
Original: CSS know how much (5)--Selector1. IntroductionStarting with this section, you'll enter the second part of this series,--CSS and HTML, which is plainly the selector.CSS defines the style, how to set these styles to the appropriate HTML node? You have to pass the selector. Let the browser know which DOM node the CSS
1. Element Selector
2. Class Selector
3. ID Selector
4. Attribute Selector
5. Derivation Selector
1. Element SelectorThe most common CSS selector is the element
This article introduces the usage and summary of the CSS3 selector, including General selectors, attribute selectors, pseudo-class selectors, and the code farmers interested in CSS selectors can read this article.A universal Selector1 *{} wildcard selector (CSS2): Fits all element objects.2 e type (HTML) selector (CSS1
I used to accept many blog posts on the Internet. I always thought that the three most important problems in css learning are box model, positioning, and floating. These three pieces of content determine the css layout capability. However, through the analysis in the previous article, to decouple xhtml from css, we should try not to rely on
1. IntroductionStarting with this section, you'll enter the second part of this series,--CSS and HTML, which is plainly the selector.CSS defines the style, how to set these styles to the appropriate HTML node? You have to pass the selector. Let the browser know which DOM node the CSS chooses, and the browser will render the corresponding style as a view.The third
Document directory
CSS hack1: differentiate IE6/7/8 from other browsers
CSS hack2: For IE6 and IE7
CSS hack3: For IE6
CSS hack4: For IE7
CSS hack5: For IE8
CSS hack6: For Firefox
CSS
, will automatically margin some margins, and in the FF margin is 0, so if you want to show consistent, so it is best to specify margin and padding in CSS, for the above two issues, my CSS is generally the first use of this style ul,form {margin:0;padding:0;} The definition is dead, so the back won't be a headache. 7. Box model explains inconsistencies In FF and IE, the box model explains inconsistencies,
CSS style selectors are divided into 4 levels, A, B, C, D, which can be used to determine the precedence of CSS selectors based on these four levels.1. If the style is in-line style (defined by style= ""), then a=12.B is the total number of ID selectors3.C is the number of class selectors.4.D is the number of type selectors5. Property selectors, pseudo-class selectors and class
1. Element Selector
2. Class Selector
3. ID Selector
4. Attribute Selector
5. Derivation Selector
1. Element SelectorThe most common CSS selector is the element
The CSS Tutorial selector includes a wildcard selector, an ID selector, a property selector, a include selector, a class selector, and so on, and their basic format is:
Wildcard
CSS Id and Class selectorIf you want to set CSS styles in HTML elements, you need to set the "id" and "class" selectors in the element.One, ID selectorThe ID selector can specify a specific style for an HTML element that is labeled with a specific ID.The HTML element sets the ID selector with the id attribute, and the
The tag selector is actually a tag in the HTML code. such as P{font-size:12px;line-height:1.6em;}The effect of the above CSS style code: Set the 12px font size for the P tag, and the line spacing to set the 1.6em style.Class SelectorClass selectors are most commonly used in CSS style encodings, such as the code in the right-hand code Editor: can be implemented as
certain properties, you can further narrow down the selection, selecting only the elements that have specific attribute values.Example 1For example, suppose you want to turn a hyperlink that points to a specified document on a WEB server into red, so you can write:{color: red;}Example 2Like a simple property selector, you can link multiple Property-value selectors together to select a document.{color: red;}This changes the text of the first hyperlink
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.