CSS 中 class 和 id 的区别是什么?
What is the difference between classes and IDs in CSS?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: easy
分类: CSS Basics
标签: css, selector, class, id, specificity
参考答案摘要
答案 id 选择器 用于选择具有唯一 id 属性值的单个 HTML 元素。 id 是唯一的 : 每个元素只能有一个 id 每个页面中同一个 id 只能出现一次 #header { width: 100%; height: 80px; background: blue } 注意: 使用 # (hash)前缀来表示 id 选择器。 class 选择器 用于选择一个或一组具有相同 class 属性值的 ...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。