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
4.5 ★ | 2 Vote
Read More
- CSS Selector in jQuery
- Selector in jQuery
- App scan feet to buy standard Vietnamese shoes
- How to quickly translate Vietnamese English on iPhone
- Things to know about the :nth-child() selector in CSS
- Tinder integrates a new AI tool to automatically select the most suitable profile photo for users
- Combinator in CSS
- How to Create a Drop Down List in Excel