在单词中单个字母的 space 内添加背景颜色

To Add bg color inside the space of an single letter in a word

我想为单词中包含 space 的单个字母添加颜色。

例如,如果我们有一个单词名称 'Does',我需要为字母 'o' 和 'e' 填充颜色,其中我需要 space 中的颜色] 的字母我想要字母的 space 内的 bg 颜色,这就是我的要求。

我附上了一张图片,检查 space 内的字母 'o,B,P' 有背景色。

完全有可能,即使仅使用 css,但您必须为每个字母和字体创建自定义解决方案,并且必须将字母换行在 span 中需要这个 CSS 并给他们适当的 类.

查笔:

http://codepen.io/anon/pen/LVRLap

h1 {
  font-size: 100px;
  font-family: Verdana;
}
.fill-letter {
  position: relative;
}
.fill-letter:after {
  display: block;
  content: "";
  position: absolute;
}
.o:after {
  background-color: orange;
  height: 45%;
  left: 25%;
  top: 30%;
  width: 50%;
  z-index: -1;
}
<h1>H<span class="fill-letter o">O</span>ME</h1>