首页 > Web开发 > 详细

CSS3三角形

时间:2015-10-15 16:31:24      阅读:275      评论:0      收藏:0      [点我收藏+]

CSS3实现三角形实例:

<!DOCTYPE html>
<html>
<head>
<!--声明当前页面的编码格式 UTF-8(国际编码)gbk(中文简体)-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--声明当前页面的三要素-->
<title>CSS三角形</title>
<meta name="Keywords" content="关键字">
<meta name="Description" content="描述">
<style type="text/css">
*{margin:0; padding:0;}/*通配符*/
body{ color:#fff;}
div.arrow-up {
  width:0px; 
  height:0px; 
  border-left:100px solid transparent;  /* left arrow slant */
  border-right:100px solid transparent; /* right arrow slant */
  border-bottom:100px solid red; /* bottom, add background color here */
  font-size:0px;
  line-height:0px;
}
/* create an arrow that points down */
div.arrow-down {
  width:0px; 
  height:0px; 
  border-left:100px solid transparent;
  border-right:100px solid transparent;
  border-top:100px solid blue;
  font-size:0px;
  line-height:0px;
}
/* create an arrow that points left */
div.arrow-left {
  width:0px; 
  height:0px; 
  border-bottom:100px solid transparent;  /* left arrow slant */
  border-top:100px solid transparent; /* right arrow slant */
  border-right:100px solid green; /* bottom, add background color here */
  font-size:0px;
  line-height:0px;
}
/* create an arrow that points right */
div.arrow-right {
  width:0px; 
  height:0px; 
  border-bottom:100px solid transparent;  /* left arrow slant */
  border-top:100px solid transparent; /* right arrow slant */
  border-left:100px solid yellow; /* bottom, add background color here */
  font-size:0px;
  line-height:0px;
}
</style>
</head>
<body >
<div>
<div class="arrow-up" onclick="aa()"></div>
<div class="arrow-down"></div>
<div class="arrow-left"></div>
<div class="arrow-right"></div>
</div>
</body>
</html>
<script>
function aa(){
location.reload();
}
</script>

技术分享

本文出自 “wennuanyiran” 博客,请务必保留此出处http://dingzhaoqiang.blog.51cto.com/5601059/1703088

CSS3三角形

原文:http://dingzhaoqiang.blog.51cto.com/5601059/1703088

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!