Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Change color in css not working

CSS:
.btn{color:red; background-color:blue;}

HTML:
<input type='button' value='Click' class='btn' />

This changed background-color but not text color

What I have tried:

CSS:
.btn{color:red; background-color:blue;}

HTML:
<input type='button' value='Click' class='btn' />
Posted
Updated 13-Aug-16 21:48pm
Comments
Mehdi Gholam 14-Aug-16 0:48am    
Use Chrome's debugger (F12) and select the element and see what css changes work.

1 solution

If this the only button with the given style on your page, then the below code will work for you.

HTML
<html>
<head>
<style>
	.btn{color:red; background-color:blue;}
</style>
</head>
<body>
	<input type='button' value='Click' class='btn' />
</body>
</html>


Thanks,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900