1

I want to change the text color of required function.Is it possible to do?

For example,

<!DOCTYPE html>
<html>
<body>
  <form>
    <input rows="4" cols="50" name="comment" required/>
    <input type="submit">
  </form>
</body>
</html>

When we run the above code,when we click on submit without entering text box it give error as "Please fill out this field".This is black in color.But, I want this should be in red color.Is it possible to change the color?

Vidya
  • 153
  • 1
  • 2
  • 14
  • Please provide full HTML snippet and JavaScript to get suggestion – ram12393 Jul 17 '18 at 05:19
  • 2
    Possible duplicate of [Change css style HTML5 form required attribute required message](https://stackoverflow.com/questions/20892240/change-css-style-html5-form-required-attribute-required-message) – Vikasdeep Singh Jul 17 '18 at 05:19
  • Possible duplicate of https://stackoverflow.com/questions/5478800/override-css-for-html5-form-validation-required-popup – Vikasdeep Singh Jul 17 '18 at 05:21

1 Answers1

1

Required is just an attribute so probably we can apply the style.

Use this style:

input:required { 
     background-color: #000;
     color:#ffffff;
}

or

input[required] {
    background-color: yellow;
}