Html 如何在六边形上应用长方体阴影
我想在六边形上画方块阴影 这是我的名片 这是我的六边形css属性Html 如何在六边形上应用长方体阴影,html,css,Html,Css,我想在六边形上画方块阴影 这是我的名片 这是我的六边形css属性 .hex1 { background-color: rgba(52,152,219,.5); text-align: center; line-height: 70px; height: 80px; width: 140px; margin: 60px 10px; position: relative; z-index: 1; box-shadow:2px
.hex1 {
background-color: rgba(52,152,219,.5);
text-align: center;
line-height: 70px;
height: 80px;
width: 140px;
margin: 60px 10px;
position: relative;
z-index: 1;
box-shadow:2px 2px 2px 2px grey;
}
.hex1:before {
border-top: 40px solid transparent;
border-bottom: 40px solid rgba(52,152,219,.5);
top: -80px;
}
.hex1:after, .hex1:before {
border-left: 70px solid transparent;
border-right: 70px solid transparent;
content: "";
position: absolute;
left: 0;
z-index: -1;
}
.hex1:after {
bottom: -80px;
border-top: 40px solid rgba(52,152,219,.5);
border-bottom: 40px solid transparent;
}
这对我的六边形没有影响。。有没有办法把五边形和方块阴影变成六边形。
请帮助您可以使用这些代码。。。。
据我所知,没有。取决于你想要的外观。这就是为什么CSS形状是个坏主意的原因。你得到了你想要的形状;伟大的但是你需要用它做些别的事情,它变得越来越难。不要试图让CSS做它不打算做的事情(即图形),只需在SVG中完成整个六边形和阴影;这将是一个更快、更容易、更灵活的过程。不是我的作品,是从:
#hexagon{
background: red;
width: 100px; height: 60px;
position: relative;
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.7);
-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.7);
box-shadow: 0 0 10px rgba(0,0,0,0.7);
}