materialize icon indicating copy to clipboard operation
materialize copied to clipboard

Custom color of input underline

Open zigy opened this issue 11 years ago • 14 comments

Please can you add custom color of input underline animation to css? Default is blue... i need orange :yum:

zigy avatar Dec 05 '14 10:12 zigy

In bin/materialize.css

textarea:focus {
  border-bottom: 1px solid #03a9f4;
  -webkit-box-shadow: 0 1px 0 0 #03a9f4;
  -moz-box-shadow: 0 1px 0 0 #03a9f4;
  box-shadow: 0 1px 0 0 #03a9f4;
}

You can replace the color code with whatever you want to change the underline.

textarea:focus {
  border-bottom: 1px solid orange;
  -webkit-box-shadow: 0 1px 0 0 orange;
  -moz-box-shadow: 0 1px 0 0 orange;
  box-shadow: 0 1px 0 0 orange;
}

Would be great if we could do this programatically.

bsteephenson avatar Dec 06 '14 21:12 bsteephenson

We are thinking of a way to do this programmatically but for now you should just overwrite it in your own CSS. Its best not to alter our CSS file if you ever intend on updating

acburst avatar Dec 06 '14 21:12 acburst

Thanks a lot :)

zigy avatar Dec 06 '14 23:12 zigy

Documentation and Sass variables added.

Dogfalo avatar Mar 08 '15 21:03 Dogfalo

Is there a way to do it programatically ?

ghost avatar Apr 30 '16 12:04 ghost

Bro its not working

gauravbankoti avatar Jun 03 '16 19:06 gauravbankoti

Not sure why, but this works for me: .input-field textarea[class=materialize-textarea]:focus { border-bottom: 1px solid #2196f3; box-shadow: 0 1px 0 0 #2196f3; }

greg-mckeon avatar Jun 15 '16 18:06 greg-mckeon

i customized the border color by (lang=pug):

input[type=text]
  &:focus:not([readonly])
    border-bottom: 1px solid #0C8CF6
    box-shadow: 0 1px 0 0 #0C8CF6

shinux avatar Jun 22 '16 03:06 shinux

Theres a guide how to target the input elements. How about the textarea? How do I change it?

update: I targeted the default ID.

#textarea1:focus {
  border-bottom: 1px solid red;
  box-shadow: 0 1px 0 0 red;
}

#textarea1:focus + label {
  color: red;
}

piq9117 avatar Aug 19 '16 03:08 piq9117

Is there any update on this ?

vTrip avatar May 15 '17 07:05 vTrip

you can change underline color by changing CSS of on focus event.

On Mon, May 15, 2017 at 1:08 PM, Vince Tripodi [email protected] wrote:

Is there any update on this ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Dogfalo/materialize/issues/192#issuecomment-301399325, or mute the thread https://github.com/notifications/unsubscribe-auth/AQKplbDd_2wQK1h4RL2zFcqAleo5FU1cks5r6ADagaJpZM4DEs6_ .

gauravbankoti avatar May 15 '17 07:05 gauravbankoti

I have done this, except the existing border applied from the mdl is present with the border style I apply

.mdl-textfield__input:focus

vTrip avatar May 15 '17 07:05 vTrip

in: theme/variables.css add this code:

$text-input-md-highlight-color-invalid: transparent; $text-input-md-highlight-color-valid: transparent; $text-input-md-show-invalid-highlight: transparent; $text-input-md-highlight-color: transparent; $text-input-md-show-valid-highlight: transparent;

but select a color!

mateusbfroemming avatar Oct 02 '17 16:10 mateusbfroemming

try this. its work for me fine:

.input-field input:focus + label { color: red !important; }

.row .input-field input:focus { border-bottom: 1px solid red !important; box-shadow: 0 1px 0 0 red !important }

ray-den avatar Apr 12 '21 12:04 ray-den