Question

I have a place holder for Username. Its placeholder text is "Enter you username *". Here i want to change the color of * (star). I google but all the solution is using javascript or jquery but i want to make it working with CSS.

Anyone know how to do this using css ?

Thanks, Aezaz

Was it helpful?

Solution 2

Yes this is possible, Check this Question, But it will have Browser Compatibility issues

Working Fiddle for Chrome

input::-webkit-input-placeholder:after /* Only for Chrome */
{
   color:red;
   content:"*";
   opacity: 1
}

Read this;

Style Placeholder Last Character with CSS

good luck!

OTHER TIPS

You wont be able to style just the star part of the placeholder. check this page out to style the placeholder using CSS

Alternatively you can use a absolutely position label/div with a span around the * then style the span.

Code below is for placeholder

::-webkit-input-placeholder {
   color: red;
}

:-moz-placeholder { /* Firefox 18- */
   color: red;  
}

::-moz-placeholder {  /* Firefox 19+ */
   color: red;  
}

:-ms-input-placeholder {  
   color: red;  
}

style only for *(star) is not..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top