css3實現的折角效果程式碼例項

antzone發表於2017-03-03

分享一段程式碼例項,它利用css3實現了折角效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
#con_right_tit5 {
  display: block;
  height: 45px;
  position: absolute;
  font-size: 18px;
  line-height: 45px;
  background: #6e80be;
  color: white;
  padding: 0 38px 0 18px;
  transition: all 0.5s ease-in-out;
  -webkit-transition: all 0.5s ease-in-out;
  -moz-transition: all 0.5s ease-in-out;
  top: 70px;
}
#con_right_tit5 a {
  color: white;
}
#con_right_tit5:hover {
  background: black;
}
#con_right_tit5::after {
  content: "";
  border-left: solid 22px rgba(0,0,0,0.9);
  border-top: white 20px solid;
  position: absolute;
  right: 0;
  top: 0;
}
</style>
</head>
<body>
  <div id="con_right_tit5">螞蟻部落</div>
</body>
</html>

相關文章