使用CSS在内部按钮

时间:2016-01-06 12:38:34

标签: html css layout

如何制作带内边框的按钮,如果我将鼠标悬停在按钮上,内边框会缩小?

f

.btnTest {
    color: #f5f5f5;
    background-color: #000000;
    -webkit-border-radius: 1;
    -moz-border-radius: 1;
    border-radius: 1px;
    /*border: 0;*/
    border-bottom: 3px solid green;
    /*-webkit-border-radius: 0;
    -moz-border-radius: 2;
    border-radius: 2px;*/
}

.btnTest:hover {
    color: #f5f5f5;
    background-color: #000000;

    -webkit-border-radius: 1;
    -moz-border-radius: 1;
    border-radius: 1px;

    border-bottom: 2px solid green;
    margin-bottom: 1px;
    /*border-bottom: 3px solid transparent;*/
}

1 个答案:

答案 0 :(得分:3)

您是否尝试过使用box-shadow



.btnTest {
      height: 40px;
      text-align: center;
      color: #f5f5f5;
      background-color: #000000;
      -webkit-border-radius: 1;
      -moz-border-radius: 1;
      border-radius: 1px;
      box-shadow: inset 0 -6px green;
}

.btnTest:hover {
      box-shadow: inset 0 -4px green;
}

<div class="btnTest">button</div>
&#13;
&#13;
&#13;