如何制作点划线下划线

时间:2015-05-23 11:32:44

标签: html css underline

如何使用。-。-.- .-来强调单词。使用HTML和CSS或MS Word的模式?

我知道CSS中有border-bottom-style属性,有点缀和虚线样式,但没有点划线或类似的东西。在MS Word中也有不同的下划线样式,但不是我需要的样式。

1 个答案:

答案 0 :(得分:0)

你可以从内联元素中  使用简单的边框底部或使用渐变和多个bg或甚至边框图像。

demo

我更喜欢渐变,它可以让你做几乎任何模式。 (从渐变中搜索bg模式,你会感到惊讶)



.dotted.underline {
  border-bottom: dotted 1px;
}

.bg {
  background: linear-gradient(to left, green 50%, transparent 50%) 0 bottom repeat-x, linear-gradient(to left, transparent 60%, red 60%, red 90%, transparent 90%) 14px 1.1em repeat-x;
  background-size: 14px 2px, 14px 2px;
  padding-bottom: 2px
}

p {
  float: left;
  width: 45%;
}

<p><span class="dotted underline">Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</span></p>
<p><span class="bg">Pellentesque habitant, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</span></p>
&#13;
&#13;
&#13;