开发者

How to make button-looking buttons that are not images in form-submit buttons?

开发者_Python百科I had a designer help me make links that look like buttons that look something like this: http://www.comehike.com/hikes/scheduled_hike.php?hike_id=233 (the yellow buttons are the RSVP, Ride, Drive, etc.)

Those are not images. They are just styled links.

My question is - can I make a similar type of non-image button for the buttons that are submit buttons in forms?

Thanks!


Submit button with hover effect.

<!doctype html>
    <head>
    <style>

    .button{
      -moz-border-radius:6px;
      -webkit-border-radius:6px;
      border-radius: 6x;
      border: 1px solid #ABABAB;
      background-image: -webkit-gradient(linear, left top, left bottom, from(#E1E1E1), to(#F7F7F7));
      background-image: -webkit-linear-gradient(top, #E1E1E1, #F7F7F7);
      background-image: -moz-linear-gradient(top, #E1E1E1, #F7F7F7);
      background-image: -ms-linear-gradient(top, #E1E1E1, #F7F7F7);
      background-image: -o-linear-gradient(top, #E1E1E1, #F7F7F7);
      background-image: linear-gradient(top, #E1E1E1, #F7F7F7);
      filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#E1E1E1', EndColorStr='#F7F7F7');
      padding: 15px 0px;
      margin: 0 auto;
      width: 224px;
      display: block;
      color: #434953;
      text-transform: uppercase;
      font: 182% "League Gothic", Helvetica, Arial, sans-serif;
      text-decoration:none;
      text-align:center;
    }

    .button:hover{
      border: 1px solid #ABABAB;
      color: #303030;
      background-image: -webkit-gradient(linear, left top, left bottom, from(#F7F7F7), to(#E1E1E1));
      background-image: -webkit-linear-gradient(top, #F7F7F7, #E1E1E1);
      background-image: -moz-linear-gradient(top, #F7F7F7, #E1E1E1);
      background-image: -ms-linear-gradient(top, #F7F7F7, #E1E1E1);
      background-image: -o-linear-gradient(top, #F7F7F7, #E1E1E1);
      background-image: linear-gradient(top, #F7F7F7, #E1E1E1);
      filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#F7F7F7', EndColorStr='#E1E1E1');
      -webkit-box-shadow: 0px 0px 5px rgba(0,0,0,0.10) inset;
      -moz-box-shadow: 0px 0px 5px rgba(0,0,0,0.10) inset;
      box-shadow: 0px 0px 5px rgba(0,0,0,0.10) inset;
    }
    </style>

    </head>
    <body>
        <input type="submit" class="button" value="submit" />
    </body>


Yes, you can style the default buttons anyway you like, here is some CSS to get you started:

HTML

<a href="#" class="button">Gray Button</a>
<a href="#" class="button red">Red Button</a>
<a href="#" class="button green">Green Button</a>

<button>Normal Button</button>
<button class="btn green">Green Button</button>
<button class="btn red">Red Button</button>
<button class="btn gray">Gray Button</button>

CSS

a, button {
    display:list-item;
    margin:10px 0;
}

a.button, button.btn {
    color: #6e6e6e;
    font: bold 12px Helvetica, Arial, sans-serif;
    text-decoration: none;
    padding: 7px 12px;
    position: relative;
    display: inline-block;
    background: #f3f3f3;
    background: -webkit-gradient(linear,0% 40%,0% 70%,from(#F5F5F5),to(#F1F1F1));
    background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#F5F5F5),to(#F1F1F1));
    border: solid 1px #dcdcdc;
    border-radius: 2px;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    margin-right: 10px;
}


a.red, button.red {
    color:#fff;
    background: red;
    background: -webkit-gradient(linear,0% 40%,0% 70%,from(#FF0000),to(#F1F1F1));
    background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#FF0000),to(#F1F1F1));
}

a.green, button.green {
    background: #7FFF24;
     background: -webkit-gradient(linear,0% 40%,0% 70%,from(#7FFF24),to(#F1F1F1));
     background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#7FFF24),to(#F1F1F1));
}

Demo link: http://jsfiddle.net/andresilich/cXv8A/1/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜