目录
Difference Between Class and ID:
HTML CLASS
• The HTML class attribute is used to define equal styles for elements with the same class name.
• All HTML elements with the same class attribute will have the same format and style.
• To style elements with a specific class, write a period (.) character, followed by the name of the class
HTML id
The HTML id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document)
• The id value can be used by CSS and JavaScript to perform certain tasks for a unique element with the specified id value.
• To style an element with a specific id, write a hash (#) character, followed by the id of the element.
Difference Between Class and ID:
• An HTML element can only have one unique id that belongs to that single element
• A class name can be used by multiple elements
CSS伪类(pseudo-class):
- 当用户将鼠标移到一个元素上时,对该元素进行样式设计
- 对已访问和未访问的链接采用不同的样式
- 当一个元素获得焦点时为其设计样式
设置当用户和网页上的事物发生交互作用时产生的效果
selector: pseudo-class {property:value;}
A CSS comment starts with /* and ends with */. Comments can also span multiple lines:
CSS Box Model:
The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content.
(Remember: When you set the width and height properties of an element with CSS, you just set the width and height of the content area.)