2016-12-14 71 views
2

如何才能在所有浏览器的文本字段中获得波浪线,如谷歌?看截图。 非常感谢!文本字段中的波浪线与CSS谷歌如

enter image description here

+0

在什么情况下你希望实现这一行?因为这显然是出现错字时出现的波浪线 – Roberrrt

+0

与google相同的上下文。它的文本更正 – fcb1900

+0

这是用户双方。 – Roberrrt

回答

4

谷歌使用编码的图像作为输入下面的跨度重复BASE64。你可以在你的范围内输入东西,它会出现在它下面。

.error:hover { 
 
    background: url(data:image/gif;base64,R0lGODlhCgAEAMIEAP9BGP6pl//Wy/7//P///////////////yH5BAEKAAQALAAAAAAKAAQAAAMROCOhK0oA0MIUMmTAZhsWBCYAOw==) repeat-x scroll 0 100% transparent; 
 
    display: inline-block; 
 
    padding-bottom: 1px; 
 
}
<span class="error">hello</span>

免责声明:您必须将鼠标悬停在跨度的效果出现。

1

如上所述here;

随着内容:

.underline:after { 
    content: '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'; 
    position: absolute; 
    width: 100%; 
    left:0; 
    overflow: hidden; 
    top:100%; 
    margin-top: -.25em; 
    letter-spacing:-.25em; 
} 

或图像:

.underline { 
    display: inline-block; 
    position:relative; 
    background: url(http://i.imgur.com/HlfA2is.gif) bottom repeat-x; 
}