css实现一个六边形布局效果代码
代码语言:html
所属分类:布局界面
代码描述:css实现一个六边形布局效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
html, body {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
#board {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: repeat(5, 1fr);
justify-items: center;
position: relative;
width: 80vh;
height: 80vh;
}
@media (max-width: 100vh) {
#board {
width: 80vw;
height: 80vw;
}
}
#board::before {
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #eae9cc;
transform: scale(1.15, 1.075);
-webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
z-index: -2;
}
#board::after {
content: "";
position: absolute;
left: 0;.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0