CSS Syntax
Add Styles to Elements with Particular Attributes
You can also apply styles to HTML elements with particular attributes.The style rule below will match all input elements that have a type attribute with a value of "text":
| input[type="text"] {background-color:blue} |
The id Selector
You can also define styles for HTML elements with the id selector. The id selector is defined as a #.The style rule below will match the element that has an id attribute with a value of "green":
| #green {color:green} |
| p#para1 { text-align:center; color:red } |
CSS Comments
Comments are used to explain your code, and may help you when you edit the source code at a later date. A comment will be ignored by browsers. A CSS comment begins with "/*", and ends with "*/", like this:| /*This is a comment*/ p { text-align:center; /*This is another comment*/ color:black; font-family:arial } |
Nhận xét
Đăng nhận xét