CSS兼容所有浏览器各个方位的三角形代码

CSS兼容所有浏览器各个方位的三角形代码:
很多网页效果都用到三角形,当然可以使用图片实现,不过也可以使用CSS结合标签实现,下面就是一段能够兼容所有浏览器实现的三角形效果,并且提供了各个方位的三角形效果,希望能够给需要的朋友带来帮助。
代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>蚂蚁部落</title>
<style type="text/css">
.rightdirection{
  width:0;
  height:0;
  line-height:0;
  border-width:20px;
  border-style:solid;
  border-color:transparent transparent transparent #A9DBF6;
}
.bottomdirection{
  width:0;
  height:0;
  line-height:0;
  border-width:20px;
  border-style:solid;
  border-color: #A9DBF6 transparent transparent transparent;
}
.leftdirection{
  width:0;
  height:0;
  line-height:0;
  border-width:20px;
  border-style:solid;
  border-color: transparent #A9DBF6 transparent transparent;
}
.topdirection{
  width:0;
  height:0;
  line-height:0;
  border-width:20px;
  border-style:solid;
  border-color: transparent transparent #A9DBF6 transparent;
}
</style>
</head>
<body>
<div class="rightdirection"></div>
<div class="bottomdirection"></div>
<div class="leftdirection"></div>
<div class="topdirection"></div>
</body>
</html>

 相关阅读:

1.border-width属性可以参阅CSS的border-width属性一章节。 
2.border-style属性可以参阅CSS的border-style属性一章节。
3.border-color属性可以参阅CSS的border-color属性一章节。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=11575

更多内容可以参阅:http://www.softwhy.com/divcss/

猜你喜欢

转载自softwhy.iteye.com/blog/2268139