css选择器笔记
p.important {color:red;} 选择器现在会匹配 class 属性包含 important 的所有 p 元素
我们假设 class 为 important 的所有元素都是粗体,而 class 为 warning 的所有元素为斜体,class 中同时包含 important 和 warning 的所有元素还有一个银色的背景 。就可以写作:
.important {font-weight:bold;}
.warning {font-style:italic;}
.important.warning {background:silver;}
后代选择器:也叫包含选择器
h1 em {color:red;} h1下面的em
.mytop .topinner{height:681px; width:997px;margin:0 auto;} mytop下面的 topinner 最终topinner被选择
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步