国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

attribute selector

Set styles for HTML elements with specified attributes.

You can set styles for HTML elements with specified attributes, not just class and id attributes.

Note: IE7 and IE8 support attribute selectors only when !DOCTYPE is specified. In IE6 and lower, attribute selection is not supported.


Attribute Selector

The following example sets the style for all elements with the title attribute:

[title]{color:red;}

Attribute and value selectors

The following example sets the style for all elements with title="php":

[title=php]{border:5px solid blue;}


Attributes and value selectors - multiple values

The following example sets a style for all elements that contain a title attribute with a specified value. Applies to attribute values ??separated by whitespace:

[title~=hello] { color:red; }

The following example styles all elements with a lang attribute that contains the specified value. Applies to attribute values ??separated by hyphens:

[lang|=en] { color:red; }


Set the style of the form

Attribute selectors are used without Particularly useful when setting styles on forms of class or id:

input[type="text"]{  
    width:150px;  
    display:block;  
    margin-bottom:10px; 
    background-color:yellow; 
    font-family: Verdana, Arial;
}
input[type="button"]{  
    width:120px;  
    margin-left:35px; 
    display:block;  
    font-family: Verdana, Arial;
}

QQ截圖20161012090827.png

Continuing Learning
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style type="text/css"> [title] { color:red; } </style> </head> <body> <h1>可以應用樣式:</h1> <h2 title="Hello world">Hello world</h2> <a title="php" href="http://php.cn">php中文網(wǎng)</a> <hr /> <h1>無法應用樣式:</h1> <h2>Hello world</h2> <a href="http://php.cn">php中文網(wǎng)</a> </body> </html>
submitReset Code