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}
The style rule below will match the p element that has an id with a value of "para1":
p#para1
{
text-align:center;
color:red
}
Remark Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.

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

Bài đăng phổ biến từ blog này

Kinh nghiệm tạo biểu đồ Use Case

PHÉP TOÁN XOR

Phần mềm hỗ trợ vẽ bản đồ tư duy trên máy tính

Power Designer 12.5