本文介绍了CSS中的波浪下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以创建一个波浪下划线,如下所示:

我只能获得实线边框:



  .err {border-bottom:1px solid red; display:inline-block;}  
 < div&名为Peter的男孩是< div class =err> woking< / div> 

没有背景图片



  .err {display:inline-block; position:relative;}。err:before {content:~~~~~~~~~~~~; font-size:0.6em; font-weight:700; font-family:Times New Roman,Serif;颜色:红色宽度:100%; position:absolute; top:12px; left:-1px; overflow:hidden;}  

 < div>名称是彼得是< div class =err> woking< / div> 



使用背景图片:



  .err {display:inline-block;位置:相对; background:url(http://i.imgur.com/HlfA2is.gif)bottom repeat-x;}  
 < div>一个名字为Peter的男孩是< div class =err> woking< / div>在街道上


Can I create a wavy underline as this :
I can only get a solid border :

.err {
  border-bottom:1px solid red;
  display: inline-block;
}
<div>A boy whose name was Peter was <div class="err">woking</div> down the street</div>

解决方案

Without background image:

.err {
  display: inline-block;
  position: relative;
}
.err:before {
  content: "~~~~~~~~~~~~";
  font-size: 0.6em;
  font-weight: 700;
  font-family: Times New Roman, Serif;
  color: red;
  width: 100%;
  position: absolute;
  top: 12px;
  left: -1px;
  overflow: hidden;
}
<div>A boy whose name was Peter was
  <div class="err">woking</div> down the street</div>

With Background image :

.err {
    display: inline-block;
    position:relative;
    background: url(http://i.imgur.com/HlfA2is.gif) bottom repeat-x;
}
<div>A boy whose name was Peter was <div class="err">woking</div> down the street</div>

这篇关于CSS中的波浪下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 05:05