JavaScript Advanced 2 CSS XML Learning_Basic Knowledge
WBOY
Release: 2016-05-16 17:55:23
Original
1108 people have browsed it
The full name of CSS is cascading style sheets, and its Chinese name is cascading style sheets, also called cascading style sheets. Its advantage is that it can make the code tidy and can batch process some styles. Basic syntax: Comment symbol: /* */ Selector symbol: selector {attribute:value} Values of the same attribute are separated by spaces, and different attributes are separated by semicolons. case sensitive. For example, if you want to customize the style of the table on the page, write table {...;...;} There are many ways to use the selector, so I was too lazy to type again. Copied from the Internet:
Selector Mode
Description
*
matches any element. (Universal selector)
E
matches any element E (such as an element of type E). (type selector)
E F
Matches any descendant element F of element E . (descendant selector)
E > F
Matches any sub-element F of element E . (child selector)
E:first-child
Matches element E when it is the first child element within its parent. (:first-child pseudo-class)
E:link E:visited
Matches element E if E is the source anchor of a hyperlink whose target has not been visited (:link) or has been visited (:visited). (link pseudo-class)
E:active E:hover E:focus
Matches E in certain user actions. (Dynamic pseudo-class)
E:lang(c)
Matches an element of type E if it is in the (human) language c (the document language determines how the language is determined). (:lang() pseudo-class)
E F
Match element F if an element E directly precedes element F . (Proximity selector)
E[attr]
Matches any element E that has the "attr" attribute set (regardless of its value). (Attribute selector)
E[attr="warning"]
Matches any element E whose "attr" attribute value is strictly equal to "warning". (Attribute selector)
E[attr~="warning"]
Matches any element E whose "attr" attribute value is a space-separated list of values, one of which is strictly equal to "warning".(属性选择器)
E[lang|="en"]
匹配其“lang”属性具有以“en”开头(从左边)的值的列表的任意元素 E 。(属性选择器)
DIV.warning
仅 HTML。用法同 DIV[class~="warning"]。(类选择器)
E#myid
匹配 ID 等于“myid”的任意元素 E 。(ID 选择器)
I’ll explain it in detail when I use it. CSS priority: In the same page or CSS file, sometimes there are multiple definitions of the same element, which requires rendering according to priority. The priority is divided into the priority of externally defined styles and the priority of other styles. Priority of externally defined styles: I won’t talk about the specific algorithm. Here I will simply talk about the results: id selector>class selector>attribute selector>pseudo-class selector>element selector>pseudo Element Selector>Global Selector>Others Priority of other style definitions: In-text style, that is, style=... in the element, this is the most advanced and takes precedence over all external definitions style. "!important" has different usage in different versions, so I won't explain it in detail. Please check it if necessary. Styles obtained through inheritance: This is the style with the lowest priority. CSS attributes: Please refer to http://www.jb51.net/w3school/css/css_reference.htm (Hey, this is so irresponsible! Fall) CSS unit: http://www.jb51 .net/w3school/css/css_units.htm (Blogger, you are such a loser! Fall!) (Pretend not to hear) Let’s enter the application link ( ̄︶ ̄) 1. Embed css style on the current page:
2. Embed css style file: We create a new css folder under the project, and then create a new css file named style.css. This is done to keep the code neat. Of course, since this is just an example, I only wrote the content in the example just now.
rel specifies the css style sheet file to be added, and type specifies the file type. href is the physical address of the file. 3 Dynamically modify css styles. Finally, it has something to do with js. This modification method is nothing more than getting the element and modifying its attributes. One thing to mention is that the attributes of the link can also be modified. For example: write a link whose id is myStyle, and then modify its import file. The method is as follows:
Okay, let’s start with the XML part (blogger you Where is your integrity? ! ) If you really want to learn xml in detail, you can start another series. . Therefore, we will briefly talk about it here. The full name of xml is: extensible markup language. It exists for better, more flexible and extensive description of data. Almost all of its tags are user-definable. For example, if we want to store information about a book, we can store it in different ways:
XML also has several dead rules: There must be a declaration statement Of course there is There can be other attributes such as encoding. All elements other than xml must be closed, that is, they must have /> Attribute values must be enclosed in quotes. Case sensitive Tag names with letters. It starts with "_" and ":" and can be followed by letters, numbers, periods, colons, and underscores. There is only one root node. XPath XPath is a language used to find and locate information in XML files. It can traverse elements and attributes in the tree. Everyone knows what numbers are. In fact, what we are talking about here is just talking about the syntax of xpath. For the syntax of xpath, please see http://www.jb51.net/w3school/xpath/xpath_syntax.htm Please briefly browse the "XPath Syntax" "XPath Axis" "XPath Operator" and reference on the above web page "XPath Functions" under the Manual column. After a rough browse, you can start this part of the exercise: First give an xml file:
XQuery Kick Start James McGovern Kurt Cagle James Linn Vaidyanathan Nagarajan < ;year>2003 49.99
(copy from website Come on, please retain permission to copy. ) The use in IE and FF is slightly different, which is more troublesome. Let’s go to IE first: In this code, it is reiterated: the script is written after the table, otherwise it will not know that sentence when compiling js Where should innerText be loaded, because it has not been rendered to the table yet. The complete code is as follows for reference: XML in IE
(Although it is copied, it is very hard to copy Shenma's =w=)
In addition to these, the xml file node can actually add conditions, for example, as long as the first one meets the conditions The node:
/bookstore/book[1]/title or the price is higher than 35:
/bookstore/book[price>35]/price before In the example, conditional selection is not used because I want to demonstrate the effect of returning all child nodes. After all, this is what is commonly used.
There is a concept mentioned here called XSLT, which is a language used to convert xml files. Its full name is: extensible stylesheet language transformation. XSLT borrows XPath to find information in xml documents. It can display the content stored in xml files as html pages according to the specified style.
Students who are specifically interested can check it out, but I’m not interested anyway. . ╮(╯▽╰)╭
Finally, we have arrived at the last concept of xml: data island
actually means that the page contains xml data information. Like css, it can be embedded internally. The method is ...... can also be imported externally:
data of xml data island The binding to the html tag is completed through datasrc and datafld, but no code can run after I tried it, so I will leave it like this for the time being. I will come back to supplement it after I finish the code.
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