CSSSelector in short
CSSSelector was inroduced as part of the HTML5/CSS2 initiativ. In many ways you may say that it is for webprogrammers what XPATH is for XML-programmers. A CSSselector make it possible to identify element(s) on a webpage combing the structure (HTML) and the stylesheet (CSS).
WXT use CSSSelector when importing HTML fragments from HTML-pages. The syntax is rather involved and you may find support at jsoup [23] , at w3schools [24] and the reference document at w3org [25] .
Just a few very simple examples
Enkle selektorer
Form | Explanation |
---|---|
e | all element av type e |
#c | element with id c |
.c | allelements with class)c |
e.c | all e-elements with class c |
* | all element |
Attributt selektorer
Form | Explanation |
---|---|
e[a] | all e-elements with a attribute |
e[a="b"] | all e-elements with a attribute with value b |
e[a~="b"] | all e-elements with a attribute where value b exist in a whitespace-separated list of values |
e[a^="b"] | all e-elements with a attribute where the value starts with b |
e[a$="b"] | all e-elements with a attribute where the value ends with b |
e[a*="b"] | all e-elements with a attribute containing b |