First, the basic composition of CSS
Selector {property: Property value}
The CSS statement is composed of the above three parts selector written in the curly braces, the curly braces for the declaration, if there are more than one declaration, attributes will be separated by ";" First, let's cite an example:
Body
{
Back
Css id selector and CLASS selectorIn CSS, a selector is a pattern used to select elements that require adding styles.The attribute selector can select an element based on its attributes and attribute values.
Three basic selector t
Child SelectorThere is also a more useful selector sub-selector , the greater than symbol (>), for selecting the first generation of child elements of the specified label element. code in the right-hand code Editor:. food>li{border:1px solid Red;}This line of code causes the child element Li (fruit, vegetable) under the class name to add a red solid line border.style type="Text/
Child SelectorCitation Link: http://blog.csdn.net/u012110719/article/details/41171517There is also a more useful selector sub-selector , the greater than symbol (>), for selecting the first generation of child elements of the specified label element. code in the right-hand code Editor:. Food>li{border:1px solid red;}This line of code causes the child element Li (fruit, vegetable) under the class name to ad
CSS id selector and cssid Selector
The id selector can match element objects with specified IDs.
Note: In the same document, IDs are unique; otherwise, problems may occur.
The id selector is defined. For example:
# Ant {color: red ;}
Set the font color in the "id" as an
One of the main advantages of CSS is that it makes it easy to apply a set of styles to all the same types of elements. Of course it is done by selectors.Basic rule structure:syntax = selector + declaration block1. Element selector--use HTML element name directly, point to document ElementUsing the element selector is t
The CSS selector is powerful, and when different selector styles are set to conflict, the style is set with a high weight selector. Weight (ie, priority) rules like this, the higher the weight, the higher the priority:
The same element can use more than one rule to specify its same style (such as font color), and each
)
:p Assword
Match
: Radio
Match
: RESET
Match
: Selected
Matches the selected
: Submit
Match
: Text
Match
: Visible
Matches all currently visible elements: the offsetwidth and offsetheight values of these elements are generally considered to be not 0, which is the opposite of ": hidden"
Note: Some of the selectors listed in the table accept paramete
Differences between class and ID selectorsLearning the class selector and ID selector, we will find that there are a lot of similarities between them, is not the two can be common? Let's not be anxious to summarize their similarities and differences in the first few years:same point: can be applied to any elementDifferent points:1.The ID selector can only be used
Simple CSS Selector-General Selector
* CSS Regular selector has 5
* Tag Tag Selector: $ (' div '), select by Tag name, return collection
* ID Selector: $ (' #top '), based on element I
Css selector and css3 Selector
I. class selector: "." class selector {css style code}
1. Use the appropriate tag to mark the content to be modified.
2.
3. stress {color: red}
Note: The class
CSS selector and css3 Selector
Original address:
Http://www.w3.org/TR/css3-selectors/
Test demo URL:
Http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/reports/implementreportTEMPLATE.html
Abstract
Selector is a matching mode in the tree structure, similar to the tech
The page, all the CSS code, needs to be written to the tag. The Type property of the style label should select Text/css, but the type attribute can be omitted. The CSS modifies all the labels on the page and must be selected with the help of a selector. Selector, you can wr
Css id selector (3) and cssid SelectorI. ID Selector
The ID selector uses the "#" prefix identifier for identification, followed by the ID name of the specified element.
For example
#box{ width:100px; height:100px;}
The element ID name is unique and can only correspond to a specific element in the document. In HTML, t
Css: first-child pseudo class selector usage introduction, first-child Selector
Css: first-child pseudo class selector usage:This selector can match the first element in the element set.: The first-child pseudo-class
different unique elements .The ID is recommended only if the target element is very unique and will never be used elsewhere on the site for this name. In other words, you should use the ID only if you are absolutely sure that the element will only occur once, if you think you might want similar elements later, just use the class. The final summary differences are as follows:First: Within the same page, ID objects with the same name are not allowed to appear, but class with the same name is allo
CSS selector and css3 Selector
1. the selector has the following types:
1. ID selector # aaaa {}
2. class selector. aaaa {}
3. Attribute Selector
Simple: h1 [attribute name] {}
Specific
Simple CSS Selector-Hierarchy Selector
* CSS level selector has 4
* 1. Descendant selector: $ (' div p '), in all descendants (descendants) of the ancestor element, query the specified element
* 2. Child element
Html5 css selector well number, difference between periods, html5 Selector
I. Understand the style composition of CSSStyle sheets in CSS are composed of rules. Each rule consists of three parts:1. selector (for example, "body" in the following example) to tell the browser wh
; No content in}//divTest2.html:Jin ——— li Shangyin The 50-chord, one-chord-one-pillar-si-hua year. Butterfly Dream Fan Butterfly, hope Emperor hath the cuckoo. The Pearl of the Sea Moon has tears, Lantian day warm jade smoke. Is this a remembrance? It was only then that it was disconsolate. STYLE2.CSS:/*:root{background:red;} *//*li:first-child{background:red;} *//*ul>li:first-child{color:red;} *//*p:first-child{color:red;} *//*td:last-child{color:re
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.