html - 为什么 !important 是必需的?
问题描述
我相信特异性是正确的,并且我检查了编译的 CSS,但我必须包含 !important 才能使其正常工作。坦率地说,我因此有点生气。任何帮助将不胜感激,并随时帮助我清理其他一些代码,我知道它并不完美:)
// Content
.section {
padding: clamp(50px, 5vh, 200px) 0;
.section__content {
width: clamp(300px, 60vw, 100vw);
margin: 0 auto;
h2 {
font-family: $ff-header;
font-size: clamp(24px, 1.1vw + 1rem, 50px);
margin-bottom: 1.3rem;
line-height: 1;
}
p {
font-family: $ff-content;
font-size: 1rem;
line-height: 120%;
}
&.section--hasImage {
display: flex;
gap: 2rem;
justify-content: space-between;
align-items: center;
.col {
width: 45%;
}
}
}
}
// Breakpoints
@media (max-width: 50em) {
.hero {
justify-content: center;
.hero__content {
text-align: center;
margin: 0;
h1 {
font-size: clamp(30px, 10vw + 1rem, 2000px);
}
p {
font-size: clamp(24px, 1vw + 1rem, 1800px);
}
}
}
section > .section__content {
width: clamp(10px, 85vw, 85vw);
&.section--hasImage {
display: block !important;
.col {
width: 100% !important;
&:last-of-type {
margin-top: 2rem;
}
}
}
}
}
解决方案
推荐阅读
- azure - 存储 REST API 返回远程名称经常无法解析
- python - 当使用符号链接而不是副本时,pip3 如何知道它应该将包安装到虚拟环境中?
- python - xgboost 如何知道训练模型的参数
- google-maps - 抽屉中的谷歌地图颤动
- jsf-2 - Rich:Editor - com.sun.faces.application.view.StateHolderSaver 无法转换为 [Ljava.lang.Object;
- regex - SPARQL 查询中的递归正则表达式以识别匹配的括号
- python-3.x - dash应用程序中的重复回调输出错误
- tarantool - How can i run tarantool 2.3.1 with the snapshot from tarantool 1.10.3
- android - Room Dao Impl 两种方法具有相同的擦除
- angular - 重新初始化 Observable 对象