开发者

How to put a waved line under misspelled words HTML

开发者 https://www.devze.com 2023-03-22 16:02 出处:网络
I have a webpage HTML & JS. I need to add a red waved-line under misspelledwords. I got my algorithm to detect those words but I just need to know how put a waved line under th开发者_JS百科ose wo

I have a webpage HTML & JS.

I need to add a red waved-line under misspelled words. I got my algorithm to detect those words but I just need to know how put a waved line under th开发者_JS百科ose words.


If you don't wanna use a gif for the curly underline, you can do it by pure css:

<span style="border-bottom: 1px dotted #ff0000;padding:1px">
    <span style="border-bottom: 1px dotted #ff0000;">
        foobar
    </span>
</span>

(Or run in JSFiddle)


Actually you don't have a standard curly underline just by using CSS, but check this tutorial on how to create one yourself:

Taken from here: http://www.phpied.com/curly-underline/

.curly-underline {
    background: url(underline.gif) bottom repeat-x;
}


Red, wavy underline is very simple, as specified in CSS 3's Text Decoration Module.

* { text-decoration: underline wavy red; }
Run me in Chrome or Firefox to see me ride over a red wave!

Browser support is catching up. You may vote for it for Microsoft Edge, which I would encourage you to do.

The spec is not new; Firefox has been supporting it since 2011, and Chrome since 2016. Hopefully, we can count on Safari and Edge to support it soon too.

Update 2017: Chrome has closed the issue in 2016, and I've tested it with Chrome 58, which works, and is a big boost of the wavy lines.

0

精彩评论

暂无评论...
验证码 换一张
取 消