1 Pseudo-class effect : CSS pseudo-class is a special effect used to add some selectors.2 Common examples:2.1anchor Pseudo-class: code:Normal syntax: a{color: #FF0000 ;} /* text color */ Pseudo-Class syntax:A: Link {color:#FF0000;} / * non-visited links * /
When using the mouse to move out of the event, there are generally two ways, one is the DOM event "onmouseover" and "onmouseout", there is a CSS pseudo-class ": hover".How to choose in practice depends on the clear understanding of the difference between them.
The HTML DOM allows JavaScript to respond to HTML events.When we bind an event to an element, a piece of JavaScript code can be executed when t
Csspseudo-classesareusedtoaddspecialeffectstosome selectors. A CSS pseudo class can be used to add special effects to some selectors. Hyperlink How to add a different color to a hyperlink in a document thisexampledemonstrateshowtoadd Differentcolorstoahyperlinkinadocument. examples instance:
The code is as follows
Copy Code
Source Code to Run []a:link {color: #FF0000}a:vis
Http://www.8go8.com/blog/post/20060612013036.html)
These two differences are confusing, especially the class and ID. I believe many people have not carefully understood the differences. Some of my understandings are as follows:1. Differences between class and IDA class is used to define one or more elements according to user-defined standards. For example, a scr
Basic CSS knowledge (color, pseudo class, Box Model), css
6, Set the color unit
L normal English word {color: attribute value red ;}
This method is simple and convenient. However, different colors may be displayed in different browsers.
* Primary colors-red, green, and blue
L octal color
Format: rgb (number,Number,Number), The number range is 0 ~ 255 r Red g gree
The reason why the parent class clears the floating (clear the floating code and place it in CSS for easy calling), floating css
Floating factors are often applied in the production of static Web pages. For example, to make block-level elements not exclusive to a row, float is often applied. However, the application will find that, after the subclass floating is
-child pseudo-ClassDefined:
First-child a pseudo-class to select the first child element of an element.
html lang="en">head> meta charset="UTF-8"> title>Documenttitle> style type="Text/css"> P: First-child {font-weight: bold;} Li : First-child {text-transform:uppercase;} style>head>body> div> p>These is the necessary steps:P>
CSS pseudo-classes are used to add special effects to certain selectors.CSS Pseudo-class (pseudo-classes) instances:
Hypertext links
This example shows how to add a different color to a hyperlink in a Document.
Hyperlink 2
This example shows how to add additional styles to Hyperlinks.
Hyperlinks-: Use of focus
This example shows
A Pseudo class (pseudoclasses) is a bolt of a selector that specifies the state of a selector that is or is related to it. They are in the form of selector:pseudoclass{property:value;, simply separating the selectors and pseudo classes with a half-width English colon (:). Many of the suggestions for CSS are not supported by browsers, but there are four of them that can be used securely on connections. li
The pseudo class of CSS, css
1.
: Link: Add styles to unaccessed links
: Visited adds a style to the accessed Link
: Hover: Add a style to the element when the mouse is hovering over the element
: Active adds a style to the activated element (clicked)
When the above four pseudo classes are used for hyperlinks, a: hover must be after a: link and a: visited, a: act
You can define your own selectors with class selector classes and identity selector IDs.
The advantage of this is that depending on the class or ID, you can perform the same HTML elements differently.
In CSS, the class selector precedes a half-width period (.), and the ID is preceded by a half-width English pound s
The class in CSS is designed to facilitate filtering (that is, selecting) elements to add styles to such elements, which are defined in the HTML document tree.But this is not enough in some cases, such as the user's interaction (hover, activation, etc.) can cause the state of the element to change, class is powerless for these dynamic changes.For this reason,
, the parent element contains only one child element, and the child element matches E.11:e:only-of-type, the selection parent element contains only one child element of the same type, and the child element matches the E12:e:empty: Selects an element that has no child elements and does not contain a text node.
Negation pseudo-Class selector:E:not (f), matches all E elements except F.
Property selector:1.E[ATTR]: Select match E element with attr att
. (This is self-understanding, unofficial explanation).
Language pseudo-Class selector:E:lang (language): Selects all elements that match E, and the matching element has the lang attribute, and its value is language.There are two ways to set up a document language. First, if you use HTML5, you can set this:or manually specify in the document:lang= "fr">
UI element State pseudo-class selector:E:checked
later, this is my purpose. I don't know what the requirements are.Next, I will change the Baidu page. Because I am relatively lazy and the big page may not be patient, I just want to imitate Baidu, and I don't know if I can do it in the past two days.
First, we can see the layout. First, we will analyze the structure and use html to get the structure out. Then we will look at the presentation method and use css to define it.
The Code is as follows:
B
9. Class of CSS and ID selectorThe difference between ID and class is that the same ID can only be used once for a page, and class can be unrestricted.Similarly, you can use a selector after the HTML selector to specify special HTML elements, such as the p.jam{value}, to act on the paragraph with the ' Jam '
addclass (Class)-adds the specified class name for each matching element. Parameter: class-one or more CSS class names to add to the element, separated by a space (String)Example one:Add the ' selected ' class to the matched eleme
Addclass (class)-Add the specified class name for each matching element.Parameter: Class-names of one or more CSS classes to be added to an element. Separate them with spaces (string)Example 1:Add the 'selected' class to the matched element.HTML code:Jquery code:$ ("P"). add
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.