如何在SASS(或纯CSS)中合并两个标记?
我希望对文档中的代码元素使用通常的“灰色背景上的单空间”渲染。HTML文档根据Markdown呈现,可以有三种类型:如何在SASS(或纯CSS)中合并两个标记?,css,sass,Css,Sass,我希望对文档中的代码元素使用通常的“灰色背景上的单空间”渲染。HTML文档根据Markdown呈现,可以有三种类型: This is the markdown version with some `inline code`. The block code can be either like this ``` for i in world: say(i) ``` or the SO way like that for i in world: say(i)
This is the markdown version with some `inline code`. The block code can be either like this
```
for i in world:
say(i)
```
or the SO way like that
for i in world:
say(i)
back to normal text
这是呈现给
code{
字体系列:“Ubuntu Mono”,monospace;
背景:浅灰色;
}
前{
背景:浅灰色;
左侧填充:30px;
}
这是带有一些内联代码的降价版本。块代码可以是这样的
pre, code {
background: lightgray;
}
还是那样
pre{
background: lightgray;
padding-left: 30px;
code{
font-family: 'Ubuntu Mono', monospace;
}
}
返回正常文本
合并CSS中的两个标记:
但我想你已经知道了。解决重复问题。尝试下面的方法
是的,但是我需要一个额外的pre
条目,只用于填充
,然后?我也会使用这种方法,是的。如果你确信pre
和code
始终是lightgray
的话,这似乎是最干净的一种,这一切都是“你的编码方式”。您可以根据标记或属性进行分组(同时将类的使用放在一边)。我认为对于代码标记,不需要背景,因为它已经分配到元素的父元素中