How to increase margins around a word except at the edges of a line

I am using <code> with extra CSS. I'd like to increase the left/right margins around

code {
  margin-left: 10px;
  margin-right: 10px;
}
This word is a <code>reserved</code> word.

我只能找到2 3种方法来解决这个问题,除非你想要一个通过文本和计数行的脚本,也就是通过包装其他文本,

span {
  margin-right: 10px;
}
code {
  margin-right: 10px;
}
<span>This word is a </span><code>reserved</code><span> word.
This word is a <br></span><code>reserved</code><span> word.
This word is a </span><code>reserved</code><span> word.</span>

使用即时兄弟选择器。

code {
  margin-left: 10px;
  margin-right: 10px;
}
br+code{
  margin-left: 0;
}
   
This word is a <br><code>reserved</code> word.
链接地址: http://www.djcxy.com/p/90462.html

上一篇: 什么GHC优化负责复制案例表达式?

下一篇: 如何增加一个词的边缘,除了在一条线的边缘