Reputation: 313
I want to put a star notation in my HTML page. #x2605;
I know that this one is for a solid star notation, but black in color. I need the star to be in red. How can I achieve this?
Upvotes: 1
Views: 29114
Reputation: 61
HTML :
<span>Date of Birth <sup class="star">*</sup> </span>
CSS :
.star{
color:red;
}
The sup tag defines superscript text which appears half a character above the normal line. So the star mark will appear little above the normal text label.
Upvotes: 6
Reputation: 327
In CSS:
.star{
color:red;
}
In HTML:
<span class="star">*</span
Note: For ★: In browser instead of ★, it is displaying â. And if we give Unicode then we are getting the star beside the word or phrase but actually we usually keep it bit upside of the word or phrase in order to mention the field as mandatory.
Upvotes: 0
Reputation: 116140
That star is just a character like any other. The only difference is that you use a unicode notation for this character. In a similar fashion, you could write &65;
for a capital A
.
Anyway, you can style it just like any other text, for instance using CSS:
In HTML:
<span class="star">★</span>
In CSS:
.star {
color: red; /* Make it red */
font-size: 200%; /* Make it twice as large */
}
Upvotes: 4
Reputation: 9200
html:
<span class="red-star">★</span>
css:
.red-star {
color: red;
}
Font tags are depreciated in html5. See http://www.w3.org/TR/html4/present/graphics.html#h-15.2.2
Upvotes: 9