css3实现六角形效果

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 css3实现六角形效果 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

css3实现六角形效果

HTML代码(index.html):

<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>css3实现六角形效果</title>
	<link rel="stylesheet" href="css/styles.css" />

</head>
<body>

<div class="container">
	

	<div class="hex hex-1 hex-gap">		
		<div class="inner">
				<h4>HOME</h4>
				<hr />
				<p>Home Sweet Home</p>
		</div>		
		<a href="#"></a>
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex hex-2">		
		<div class="inner">
				<h4>ABOUT US</h4>
				<hr />
				<p>We Are The Experts</p>
		</div>		
		<a href="#"></a>
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>


	<div class="hex hex-3">		
		<div class="inner">
				<h4>CONTACT US</h4>
				<hr />
				<p>We Open Everyday</p>
		</div>		
		<a href="#"></a>
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>	
	
	<div class="hex" style="background-image: url(images/2.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/3.jpg);">		
		<a href="#"></a>
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/4.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/5.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex hex-gap" style="background-image: url(images/6.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/7.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/8.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>	
	
	<div class="hex" style="background-image: url(images/9.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/10.jpg);">		
		<a href="#"></a>	
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>	
	
	<div class="hex" style="background-image: url(images/11.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/12.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>	
	
	<div class="hex hex-gap" style="background-image: url(images/13.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>
	
	<div class="hex" style="background-image: url(images/14.jpg);">		
		<a href="#"></a>		
		<div class="corner-1"></div>
		<div class="corner-2"></div>		
	</div>	
</div>
</body>
</html>









CSS代码(styles.css):

body{font-family:arial;font-size:12px;background:#f6f7f0;margin:0;padding:0;}
#info{background:#333;opacity:0.8;position:absolute;top:5px;right:5px;width:280px;color:#fff;border-radius:5px;z-index:10}
#info p{padding:0 10px;}
a{text-decoration:none;color:#3e8ed7;}
a:hover{color:#61b7e6;}
.container{width:700px;height:100%;position:absolute;top:50px;left:50%;margin-left:-350px;}
/* HEXAGON STARTS HERE */
.hex{width:150px;height:86px;background-color:#ccc;background-repeat:no-repeat;background-position:50% 50%;-webkit-background-size:auto 173px;-moz-background-size:auto 173px;-ms-background-size:auto 173px;-o-background-size:auto 173px;position:relative;float:left;margin:25px 5px;text-align:center;zoom:1;}
.hex.hex-gap{margin-left:86px;}
.hex a{display:block;width:100%;height:100%;text-indent:-9999em;position:absolute;top:0;left:0;}
.hex .corner-1,.hex .corner-2{position:absolute;top:0;left:0;width:100%;height:100%;background:inherit;z-index:-2;overflow:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-o-backface-visibility:hidden;backface-visibility:hidden;}
.hex .corner-1{z-index:-1;-webkit-transform:rotate(60deg);-moz-transform:rotate(60deg);-ms-transform:rotate(60deg);-o-transform:rotate(60deg);transform:rotate(60deg);}
.hex .corner-2{-webkit-transform:rotate(-60deg);-moz-transform:rotate(-60deg);-ms-transform:rotate(-60deg);-o-transform:rotate(-60deg);transform:rotate(-60deg);}
.hex .corner-1:before,.hex .corner-2:before{width:173px;height:173px;content:'';position:absolute;background:inherit;top:0;left:0;z-index:1;background:inherit;background-repeat:no-repeat;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;-ms-backface-visibility:hidden;-o-backface-visibility:hidden;backface-visibility:hidden;}
.hex .corner-1:before{-webkit-transform:rotate(-60deg) translate(-87px,0px);-moz-transform:rotate(-60deg) translate(-87px,0px);-ms-transform:rotate(-60deg) translate(-87px,0px);-o-transform:rotate(-60deg) translate(-87px,0px);transform:rotate(-60deg) translate(-87px,0px);-webkit-transform-origin:0 0;-moz-transform-origin:0 0;-ms-transform-origin:0 0;-o-transform-origin:0 0;transform-origin:0 0;}
.hex .corner-2:before{-webkit-transform:rotate(60deg) translate(-48px,-11px);-moz-transform:rotate(60deg) translate(-48px,-11px);-ms-transform:rotate(60deg) translate(-48px,-11px);-o-transform:rotate(60deg) translate(-48px,-11px);transform:rotate(60deg) translate(-48px,-11px);bottom:0;}
/* Custom styles*/
.hex .inner{color:#eee;}
.hex h4{font-family:'Josefin Sans',sans-serif;margin:0;}
.hex hr{border:0;border-top:1px solid #eee;width:60%;margin:15px auto;}
.hex p{font-size:16px;font-family:'Kotta One',serif;width:80%;margin:0 auto;}
.hex.hex-1{background:#74cddb;}
.hex.hex-2{background:#f5c53c;}
.hex.hex-3{background:#80b971;}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
131.12 KB
Html CSS3特效
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章