Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS pseudo elements how to change the color

Tags:

css

I'm not good at CSS. I'm a java script developer. I have found a code to add my project to add asterisk mark in the input fields. This is the code. Can anybody tell me how to make this asterisk mark color red.

.required label::after {
  content: "*";
}
like image 548
Pathum Kalhan Avatar asked Dec 01 '25 05:12

Pathum Kalhan


2 Answers

You can use below CSS style

.required label::after {
  content: "*";
  color:#ff00ff;
}
like image 158
Hariom Singh Avatar answered Dec 03 '25 18:12

Hariom Singh


You can just use the color to set the color of the pseudo element as well.

.required label:after {
  content: '*';
  color: #f00;
}
<div class='required'>
  <label>First Name :</label>
  <input type ='text' />
</div>
like image 35
Abin Thaha Avatar answered Dec 03 '25 19:12

Abin Thaha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!