有沒有辦法在懸停時只爲div的邊緣創建邊框。以下是使用bootstrap創建的網格的基本佈局。這裏是我的codepen http://codepen.io/anon/pen/zvxEYw使用引導懸停在div上的邊框的邊框
<div class="product-grid col-md-4">
<a class="preview" href="#">PREVIEW</a>
</div>
.product-grid{
margin:30px 0 0 30px;
border:1px solid #ccc;
height:300px;
display:block;
}
.product-grid:hover{
border:1px solid #000;
}
/* Preview */
.preview {
opacity: 0;
position: absolute;
left: 40px;
right: 40px;
top: 0;
height: 30px;
line-height: 32px;
background-color: #fe3;
text-align: center;
text-decoration: none;
color: #000;
transition: .2s;
}
.product-grid:hover .preview {
opacity: 1;
top: 80px;
}
爲了清楚明白,我附上下面
http://stackoverflow.com/questions/16050006/css-border-on-corners-only –