css3實現的邊框陰影效果程式碼例項

螞蟻小編發表於2017-02-26

本章節分享一段程式碼例項,它使用css3實現了邊框陰影效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.box-shadow {
  margin: 200px;
  height: 200px;
  width: 300px;
  text-align: center;
  line-height: 200px;
  background: white;
}
.box-shadow h3 {
  position: relative;
  text-align: center;
}
.effect {
  box-shadow: 0 1px 3px rgba(0,0,0,0.2),0 0 40px rgba(0,0,0,0.1) inset;
  -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2),0 0 40px rgba(0,0,0,0.1) inset;
  -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.2),0 0 40px rgba(0,0,0,0.1) inset;
  position: relative;
  animation:;
}
.effect::after {
  content: "";
  height: 100px;
  width: 250px;
  margin: 0 auto;
  z-index: -1;
  position: absolute;
  left: 25px;
  bottom: 0;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  -webkit-box-shadow: 0 0 20px rgba(0,0,0,0.6);
  -moz-box-shadow: 0 0 20px rgba(0,0,0,0.6);
  border-radius: 150px/10px;
}
</style>
</head>
<body>
  <div class="box-shadow effect">
    <h2>螞蟻部落</h2>
  </div>
</body>
</html>

相關閱讀:

(1).box-shadow屬性可以參閱CSS3 box-shadow一章節。

(2).border-radius可以參閱CSS3 border-radius一章節。

相關文章