ID selector in CSS
In CSS, id is used to style the element with the specified id.
In CSS, ID is used to style the element with the specified id. IDs are often used for objects that are unique in the website, each id name is unique to an element.
To declare ID in CSS, we use the following syntax:
#ten_id {
định dạng các thuộc tính CSS
}
For example:
#quantrimang {
background-color: black;
color: white;
font-size: 30px;
In HTML, the ID is open in the HTML tag with the syntax: id=ten_id
.
For example:
Website TipsMake.com
Note :
- ID can be used with any HTML element.
- ID names are only allowed to contain letters, numbers, underscores
_
, hyphens-
. ID names should not begin with numbers - ID values are case sensitive.
- ID value must contain at least 1 character and no spaces.
For example:
TECHNOLOGY VILLAGE
TECHNOLOGY
SCIENCE - LIFE
Result:
See more:
- Learn Basic CSS
- Learn Advanced CSS
Update 27 May 2019
You should read it
- The id attribute in HTML
- Class selector in CSS
- Attribute Selector - Attribute Selector in CSS
- Class properties in HTML
- Attributes in HTML
- HTML color code - color code table in html
- Style properties in HTML
- Attribute in C #
- Introduction to HTML
- Display (inline-block) properties in CSS
- 5 steps to learn a dynamic HTML web component profile
- Paths in HTML