开发者

HTML Button with CSS

开发者 https://www.devze.com 2023-03-07 16:37 出处:网络
I have this CSS for a button- a.button { border-top: 1px solid #7f93bc; background: #7f93bc; background: -webkit-gradient(linear, left top, left bottom, from(#7f93bc), to(#7f93bc));

I have this CSS for a button-

a.button {
   border-top: 1px solid #7f93bc;
   background: #7f93bc;
   background: -webkit-gradient(linear, left top, left bottom, from(#7f93bc), to(#7f93bc));
   background: -moz-linear-gradient(top, #7f93bc, #7f93bc);
   padding: 10.5px 21px;
   -webkit-border-radius: 0px;
   -moz-border-radius: 0px;
   border-radius: 0px;
   -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
   -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
   box-shadow: rgba(0,0,0,1) 0 1px 0;
   text-shadow: rgba(0,0,0,.4) 0 1px 0;
   color: white;
   font-size: 18px;
   font-family: 'Lucida Grande', Helvetica, Arial, Sans-Serif;
   text-decoration: none;
   vertical-align: middle;
   }
a.button:hover {
   border-top-color: #0e1f5b;
   background: #0e1f5b;
   color: #ffffff;
 开发者_StackOverflow   }
a.button:active {
   border-top-color: #0e1f5b;
   background: #0e1f5b;
   }

The below turns out a link. I want to make it turn out a button in the above style. What can I replace the below with?

$theOffers .= "<br><li class=\"gateway-offer\"><a href=\"http://fakeurlforanon/aff_c?offer_id=".$offer['id']."&aff_id=$affiliateId\" target=\"_blank\">$offer[name]</a></li><br>";


Just add the class to the tag:

...ffer\"><a class=\"button\" href=\"http://fakeurlf...


Looks like you just need to add class="button" to your anchor tag, like so:

$theOffers .= "<br><li class=\"gateway-offer\"><a class=\"button\" href=\"http://fakeurlforanon/aff_c?offer_id=".$offer['id']."&aff_id=$affiliateId\" target=\"_blank\">$offer[name]</a></li><br>";

That should make it pick up all the button styling you already have.


You forgot to actually specify that the <a> should be of class button.

$theOffers .= '
<br />
<li class="gateway-offer">
    <a class="button" href="http://fakeurlforanon/aff_c?offer_id=' . $offer["id"] . '&amp;aff_id=' . $affiliateId. '" target="_blank">' . $offer["name"] . '</a>
</li><br />';
0

精彩评论

暂无评论...
验证码 换一张
取 消