CSS: CSS property selector

ylbtech-CSS: CSS property selector

 

1.Back to top
1、

CSS  property selector


HTML element styles with specific attributes

HTML element styles with specific attributes are not just class and id .

Note: IE7 and IE8 need to declare !DOCTYPE to support attribute selectors! IE6 and lower versions do not support attribute selectors.


attribute selector

The following example turns all elements containing the title blue:

example

[title]{color:blue; }

try it"


Attribute and value selectors

The following example changes the border style of the title='runoob' element:

example

[title=runoob]{border:5pxsolidgreen; }

try it"


Selectors for properties and values ​​- multiple values

The following is an example of an element style that contains a title attribute with a specified value, using (~) to separate the attribute and value:

example

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

try it"

The following is an example of an element style containing a lang attribute with a specified value, using (|) to separate the attribute and value:

example

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

try it"


form style

Attribute selector styles do not need to use the form of class or id:

example

input[type="text"]
{
    width:150px;
    display:block;
    margin-bottom:10px;
    background-color:yellow;
}
input[type="button"]
{
    width:120px;
    margin-left:35px;
    display:block;
}
try it"
2、
2.Back to top
 
3.Back to top
 
4.Back to top
 
5.Back to top
1、
2、
 
6.Back to top
 
warn Author: ylbtech
Source: http://ylbtech.cnblogs.com/
The copyright of this article belongs to the author and the blog garden. Reprints are welcome, but this statement must be retained without the author's consent, and a link to the original text should be given in an obvious position on the article page, otherwise Reserve the right to pursue legal responsibility.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324764953&siteId=291194637