Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling black underline on text in HTML input-field

Tags:

html

css

I have a Cordova app that has a search field in a toolbar. It is a regular HTML input field with the borders hidden and background set to be transparent. When the user starts typing on Android (5.0), the current word is underlined in black, while the keyboard is offering up auto-complete suggestions. I have tried to set the following attributes on the input field:

<input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" class="search" ng-change="search()" ng-model="ident" placeholder="Search" style="text-decoration: none;">

This does not seem to fix the problem however. How can I prevent this behaviour?

Black underline on text in HTML input field

like image 737
Laurens Avatar asked Feb 23 '15 18:02

Laurens


People also ask

How do I get rid of the underline in a text box?

Add the same text-decoration: none ! important; to . text-row and if it still doesn't work, I guess the line isn't an underline. So you try others like outline: none and border: none .

How do you change text underline in HTML?

To underline a text in HTML, use the <u> tag. The <u> tag deprecated in HTML, but then re-introduced in HTML5. Now it represents a text different from another text stylistically, such as a misspelled word.

Why all of my HTML is underlined?

You have wrapped parts of your HTML markup with <u> elements which have a default style of text-decoration: underline; which comes from the user agent's default stylesheet. I suggest amending the HTML markup to remove the <u> elements.

How do you end an underline in HTML?

To remove underline from a link in HTML, use the CSS property text-decoration. Use it with the style attribute. The style attribute specifies an inline style for an element. Use the style attribute with the CSS property text-decoration to remove underline from a link in HTML.


1 Answers

use border-bottom instead of text-decoration:

a:link {
text-decoration: none;
border-bottom: none;
-webkit-box-shadow: none;
box-shadow: none;
}

You can try adding this: !important right before the ; symbol. This will give the code priority.

a:link {
text-decoration: none!important;
border-bottom: none!important;
}
like image 62
Sadaf Niknam Avatar answered Sep 29 '22 02:09

Sadaf Niknam