HTML code to underline the next character

how

abcdef _ 

What HTML character code do I need to insert before b to underline b?

I need this inside the html attribute (input field value), so html tags like <u> are not acceptable


Example:

<input type="submit" value="UnderlineMeifUknowHow" accesskey="n" />

I want the first "n" from UnderlineMeifUknowHow to be underlined

+6
source share
9 answers

As I push you to comments, there are special characters, and I finally found it!

e

Poorly, it depends on which font you use to move the underline directly below the letter. It is also known as the “combining character” and can be found in U + 0332 in the Unicode table.

+3
source

You can just put &#818; after any word and underline its HTML code.

 <input type=button value=S&#818;end> 

It will be:

Submit

But you can create a JavaScript function to do this for you, see

 function underlineWord(pos,str){ str = str.substring(0,pos) + str[pos] + "&#818;" + str.substring(pos+1,str.length); return str; } 

Thus, if you do:

 underlineWord(0,"string"); 

You will have:

line

+6
source

Try the following:

 abcde<br /> <span style="visibility:hidden">a</span>_ 

Example: http://jsfiddle.net/fXMrN/

+4
source

Try a<u>b</u>cdef , this should help. Learn more about the HTML u tag .

+3
source

you can wrap b with <span> in the style of text-decoration:underline or <u>

+3
source

Use <u> Tags

Please note that the <u> tags are out of date and thus invalidate your document. It is deprecated because users can confuse it with a link and allow confusion.

In any case, you should use CSS for any style.

+2
source

Do you mean volume b with u tag?

 <u>b</u> 

To meet the standards, I would use inline CSS:

 <span style="text-decoration:underline;">b</span> 

I would like to refer to a guide like http://w3schools.com/html/ for answers to quick help questions like this.

+1
source

CSS

 <style> .underline { text-decoration: underline; } </style> 

Markup:

 <input style="text-decoration:underline;" type="submit" value="underlined" /> 
+1
source

This cannot be done inside the attribute as you want, and FWIW you probably shouldn't style the text inside the attributes.

External attributes (i.e. using HTML elements) can use the <u> element, but this is presentation markup and is usually considered a bad idea. The best way to emphasize something is to use CSS ( text-decoration: underline; ) for any element that you want to emphasize.

+1
source

Source: https://habr.com/ru/post/905027/


All Articles