如您所见,表单左侧和右侧有三角形。并且双阴影0 0 0 2px,0 0 0 6px。我已经实现了这个功能:after和:before,但它打破了布局。如果你能帮助我,请帮忙。我会很高兴任何可以解决这个问题的链接或文章
https://jsfiddle.net/BeriaFantom/sLkdy0fx/1/
#middle {
position: relative;
}
#middle-form {
position: absolute;
bottom: 0;
right: 0;
left: 0;
}
#middle-form:after,
#middle-form:before {
position: absolute;
top: 0;
display: block;
content: '';
width: 0;
height: 0;
}
#middle-form::after {
right: -24px;
border-bottom: 75px solid transparent;
border-top: 75px solid transparent;
border-left: 24px solid #1e9baf;
}
#middle-form::before {
left: -24px;
border-bottom: 75px solid transparent;
border-top: 75px solid transparent;
border-right: 24px solid #1e9baf;
}

<div id="middle">
<div id="middle-form" class='container'>
<h2>заказать мастера</h2>
<form action="" class='clear'>
<input type="text" class='name'>
<input type="tel" class='tel'>
<button class="btn-sen">отправить</button>
</form>
</div>
</div>
&#13;
答案 0 :(得分:2)
我已经改变了你的小提琴,现在检查。
body {background: black;}
#middle {position: relative; width: 300px; margin-left: 100px; box-shadow: 0 0 10px 2px #ccc;}
#middle-form {background: #1e9baf none repeat scroll 0 0; height: 128px; position: relative; z-index: 100; border:2px solid #fff; border-width:2px 0;}
#middle:after, #middle:before {background: #1e9baf none repeat scroll 0 0; box-shadow: 0 0 10px 2px #ccc; content: ""; display: block; height: 90px; position: absolute; top: 19px; transform: rotate(45deg); width: 90px; z-index: 10; border:2px solid #fff;}
#middle::after {right: -48px;}
#middle::before {left: -48px;}
&#13;
<div id="middle">
<div id="middle-form" class='container'>
<h2>заказать мастера</h2>
<form action="" class='clear'>
<input type="text" class='name'>
<input type="tel" class='tel'>
<button class="btn-sen">отправить</button>
</form>
</div>
</div>
&#13;
答案 1 :(得分:1)
我会再次使用渐变的东西
#middle {
font-size: 14px;
display: table;
margin: 2em auto;
padding: 0 3em 1.5em;
text-align: center;
background: linear-gradient(to bottom, gray 4px, white 4px, white 6px, #1e9baf 6px, #1e9baf calc(100% - 6px), white calc(100% - 6px), white calc(100% - 4px), gray calc(100% - 4px)) center no-repeat, linear-gradient(70deg, transparent 1.5em, gray 1.5em, gray calc(1.5em + 3px), white calc(1.5em + 3px), white calc(1.5em + 4px), #1e9baf calc(1.5em + 6px)) bottom left no-repeat, linear-gradient(-70deg, transparent 1.5em, gray 1.5em, gray calc(1.5em + 3px), white calc(1.5em + 3px), white calc(1.5em + 4px), #1e9baf calc(1.5em + 6px)) bottom right no-repeat, linear-gradient(-250deg, transparent 1.5em, gray 1.5em, gray calc(1.5em + 3px), white calc(1.5em + 3px), white calc(1.5em + 4px), #1e9baf calc(1.5em + 6px)) top left no-repeat, linear-gradient(250deg, transparent 1.5em, gray 1.5em, gray calc(1.5em + 3px), white calc(1.5em + 3px), white calc(1.5em + 4px), #1e9baf calc(1.5em + 6px)) top right no-repeat;
background-size: calc(100% - 3em - 8px) 100%, 50.05% 50.05%, 50.05% 50.05%, 50.05% 50.05%, 50.05% 50.05%;
box-shadow: 0 2.25em 15px -2em white, 0 -2.25em 15px -2em white
}
h2 {
color: white;
text-shadow: 1px 1px 1px #333;
}
input,
button {
box-shadow: inset 0 3px 8px -1px #555, inset 0 0 0 2em white;
background: none;
border: none;
border-radius: 3px;
font-size: 1em;
padding: 0.25em 0.5em;
font-variant: small-caps;
margin: 0.5em 0.1em;
width: 11em;
}
button {
background: linear-gradient(to top, #ffab00 30%, #fff800);
padding: 0.2em 3em;
width: 9.5em;
font-weight: bold;
box-shadow: 2px 2px 1px #A46D02;
text-shadow: 0px 1px 1px white
}
/* demo purpose, show transparency */
html {
min-height: 100%;
background: linear-gradient(45deg, gray, white, #333, gold, tomato, gray, turquoise, tomato);
}
<div id="middle">
<div id="middle-form" class='container'>
<h2>заказать мастера</h2>
<form action="" class='clear'>
<input placeholder=" Name" type="text" class='name' />
<input placeholder="☎ Phone" type="tel" class='tel' />
<button class="btn-sen">отправить</button>
</form>
</div>
</div>
答案 2 :(得分:0)
对于具有对角线的div,您可以使用trasform 2d skew
这是一个样本
#id_div_diag {
-ms-transform: skew(20deg);
-webkit-transform: skew(20deg);
transform: skew(20deg);
}
解决方案是组合更多不同的div与不同的变换