Reputation: 7145
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: "*";
}
Upvotes: 3
Views: 7640
Reputation: 1540
You can use below CSS style
.required label::after {
content: "*";
color:#ff00ff;
}
Upvotes: 6
Reputation: 1219
you can simply add color property in your css class. Try below snippets
.required label::after {
content: '*';
color:#f00;
}
OR
.required label::after {
content: '*';
color:red;
}
OR
.required label::after {
content: '*';
color:rgb(255,0,0);
}
Upvotes: 1
Reputation: 89
This might work for you perfectly
.required label::after {
content: '*';
width: 10px;
color: blue;
}
Do provide width.
Upvotes: 3
Reputation: 4633
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>
Upvotes: 4
Reputation: 14541
Like any other element, you can add a color property to it.
.required label::after {
content: "*";
color: red;
}
Here's an example:
.required label::after {
content: "*";
color: red;
}
<div class="required">
<label>Some text</label>
</div>
Upvotes: 4