如何添加自定义框阴影

时间:2016-09-14 15:18:45

标签: css box-shadow

我只想在图像下面的设计中使用框阴影

enter image description here

我已经为所有

尝试了以下代码

box-shadow: inset 0 0px 2px rgba(0,0,0,.39);

但输出看起来像

enter image description here

我更改了框阴影值无法获得准确的输出。任何人都帮助...谢谢。

2 个答案:

答案 0 :(得分:1)

更好地使用-webkit-box-shadow-moz-box-shadow& box-shadow以获得更好的输出。



input{
  width:100px;
  padding:15px;
  -webkit-box-shadow: inset 0px 2px 15px -5px rgba(0,0,0,0.39);
-moz-box-shadow: inset 0px 2px 15px -5px rgba(0,0,0,0.39);
box-shadow: inset 0px 2px 15px -5px rgba(0,0,0,0.39);
}

<input type="text" />
&#13;
&#13;
&#13;

答案 1 :(得分:1)

&#13;
&#13;
.select-style {
    padding: 0;
    margin: 0;
    border: 1px solid #ccc;
    width: 150px;
    border-radius: 1px;
    overflow: hidden;
    box-shadow: inset 0px 1px 5px -2px rgba(0,0,0,0.4);
    background: #e5e5e5 url("http://www.scottgood.com/jsg/blog.nsf/images/arrowdown.gif") no-repeat 90% 50%;
}

.select-style select {
    padding: 5px 8px;
    width: 130%;
    border: none;
    box-shadow: none;
    background-color: transparent;
    background-image: none;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
}

.select-style select:focus {
    outline: none;
}
&#13;
<div class="select-style">
  <select>
    <option value="orders">Completed Orders</option>
    <option value="name">Name</option>
    <option value="age">Age</option>
    <option value="class">Class</option>
  </select>
</div>
&#13;
&#13;
&#13;