为了解释我希望实现的目标,假设我有一个包含许多类的长 css 文档。我有几个不同的“h1”标签和“h2”标签、“iframe”、“ul”,许多都有不同的类。是否可以将所有“h1”或其他标签(无论类别如何)组合在一起,并且所有“iframe”都可以在 Notepad++ 中组合在一起。
h1.left {
font-family: Papyrus;
font-size: 45px;
color: white;
margin-left: 15px;
}
h1.center {
font-family: Papyrus;
font-size: 30px;
color: white;
text-align: center;
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<pre>PS: All code in this document is just
so it would be seen as I meant it to be,
and I hope you can read it right.<pre>
<!--For example:-->
+ h1
<!--And if i roll the h1 down, i can get all h1 in the document:-->
<ul>
<li> h1.left</li>
<li>h1.center <li>
<li>h1.right<li>
<!--And if i open those again, I will get all the code that is inside them-->
</body>
</html>
最佳答案
不确定 Notepad++ 是否可以运行 SASS,但它听起来像你想要的。
h1 {
color: white;
font-family: Papyrus;
text-align: center;
&.left {
font-size: 45px;
}
&.center {
font-size: 30px;
}
}
关于html - 我可以通过标签来组织 CSS,而不是将它们全部分开吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46191608/