css內邊框效果程式碼例項

antzone發表於2017-04-10

分享一段程式碼例項,它實現了內邊框效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼執行程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
body {
  padding: 0;
  margin: 0;
  font-size: 22px;
  color: white;
  text-align: center;
  font-weight: 700;
}
div.warp {
  width: 500px;
  height: 297px;
  margin: 50px 0 0 100px;
  position: relative;
  border-radius: 10px;
  cursor: pointer;
}
div.warp img {
  width: 500px;
  height:290px;
  border-radius: 10px;
}
div.warp .mask {
  width: 500px;
  height: 248px;
  position: absolute;
  top: 0;
  background: white;
  opacity: 0.4;
  display: none;
  border-radius: 5px;
}
div.warp .bottom_style {
  width: 492px;
  height: 242px;
  position: absolute;
  bottom: 0;
  left: 0;
  border: 4px solid #54a219;
  border-bottom: 52px solid #54a219;
  display: none;
  border-radius: 10px;
}
div.warp:hover .show {
  display: block;
}
div.warp span {
  vertical-align: middle;
  display: inline-block;
  position: absolute;
  bottom: 10px;
  left: 25%;
}
</style>
</head>
<body>
<div class="warp" id="touch">
  <img src="http://www.softwhy.com/demo/CSS/img/2.jpg" id="img">
  <div class="mask show"></div>
  <div class="bottom_style show"></div>
  <span>url是www.softwhy.com</span>
</div>
</body>
</html>

相關文章