DaniSpringer.com DaniSpringer.com - 5 months ago 7
CSS Question

Adding CSS to <a> Tag Not Working

I tried adding CSS to a button, but it just outputs as a plain hyperlink.

Do I need to use a

<button>
tag instead?

<a href="example.com" style=".button { /*Tons of correctly written, irrelevant CSS */ }">text</a>

Answer

Its should be like this -

<a title="Subcribe now" href="http://www.youtube.com/user/danielspringermusic?sub_confirmation=1" style="text-decoration:none; text-align:center; 
 padding:6px 12px; 
 border:solid 3px #cc6300; 
 -webkit-border-radius:8px;
 -moz-border-radius:8px; 
 border-radius: 8px; 
 font:17px Verdana, Geneva, sans-serif; 
 font-weight:bold; 
 color:#000000; 
 background:#c4302b; 
 -webkit-box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff; 
 -moz-box-shadow: 0px 0px 2px #bababa,  inset 0px 0px 1px #ffffff;  
 box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff;  

 text-shadow: 0px 0px 5px #bababa; 
 filter: dropshadow(color=#bababa, offx=0, offy=0); }.button:hover{
 padding:6px 12px; 
 border:solid 3px #cc6300; 
 -webkit-border-radius:8px;
 -moz-border-radius:8px; 
 border-radius: 8px; 
 font:17px Verdana, Geneva, sans-serif; 
 font-weight:bold; 
 color:#000000; 
 background-color:#c42b3d; 
 background-image: -moz-linear-gradient(top, #c42b3d 0%, #2ba0c4 100%); 
 background-image: -webkit-linear-gradient(top, #c42b3d 0%, #2ba0c4 100%); 
 background-image: -o-linear-gradient(top, #c42b3d 0%, #2ba0c4 100%); 
 background-image: -ms-linear-gradient(top, #c42b3d 0% ,#2ba0c4 100%); 
 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ba0c4', endColorstr='#2ba0c4',GradientType=0 ); 
 background-image: linear-gradient(top, #c42b3d 0% ,#2ba0c4 100%);   
 -webkit-box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff; 
 -moz-box-shadow: 0px 0px 2px #bababa,  inset 0px 0px 1px #ffffff;  
 box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff;  

 text-shadow: 0px 0px 5px #bababa; 
 filter: dropshadow(color=#bababa, offx=0, offy=0);}.button:active{
 padding:6px 12px; 
 border:solid 3px #cc6300; 
 -webkit-border-radius:8px;
 -moz-border-radius:8px; 
 border-radius: 8px; 
 font:17px Verdana, Geneva, sans-serif; 
 font-weight:bold; 
 color:#000000; 
 background:#c4302b; 
 -webkit-box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff; 
 -moz-box-shadow: 0px 0px 2px #bababa,  inset 0px 0px 1px #ffffff;  
 box-shadow:0px 0px 2px #bababa, inset 0px 0px 1px #ffffff;  

 text-shadow: 0px 0px 5px #bababa; 
 filter: dropshadow(color=#bababa, offx=0, offy=0);}">SubscribE</a>