【发布时间】:2018-01-23 10:45:40
【问题描述】:
我有一个三角形多边形,但有一个问题,我想将它放在“onebysign”div 的正上方,但定位不起作用,它还必须保持响应,所以当我更改屏幕尺寸时,多边形停留在他的位置地点。
所以基本上:我希望多边形三角形 div 与“onebysign”(某物)div“连接”,当屏幕宽度发生变化时,它必须保持响应并且不移动。
JSfiddle:https://jsfiddle.net/fmg6orkd/
HTML 和 CSS:
body {
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
background-color: #f2f2f2;
}
.events {
padding: 20px 100px;
}
.textInfo {
text-transform: uppercase;
font-weight: 600;
color: #085DAD;
padding: 10px;
background-color: white;
}
.onebyone {
background-color: grey;
width: 100%;
padding-top: 100%;
/* 1:1 Aspect Ratio */
position: relative;
/* If you want text inside of it */
background-size: cover;
}
.onebytext {
position: absolute;
top: 10px;
left: 0;
bottom: 0;
right: 0;
text-align: center;
font-size: 32px;
color: white;
width: 90%;
left: 5%;
}
.onebysign {
position: absolute;
left: 0;
bottom: 0px;
right: 0;
text-align: center;
font-size: 20px;
background-color: red;
font-size: 24px;
}
.onebytext,
.onebysign {
position: absolute;
text-align: center;
color: white;
}
.submitBtn {
background-color: #0099CC;
text-transform: uppercase;
padding: 10px;
border-radius: 50px;
border: 0px;
width: 70%;
margin: 10px 0;
}
.triangle {
width: 100%;
position: absolute;
left: 0px;
top: 0px;
}
svg {
width: 100%;
height: auto;
}
<div class="row events">
<div class="onebyone">
<div class="onebytext">
<div class="textInfo">Test</div>
</div>
<div class="triangle" data-type="vertical_parallax" data-speed="2">
<svg x="0px" y="0px" width="410" height="410" viewBox="0 0 310 310">
<polyline fill="#CC0000" points="0,0 0,20 310,20" />
</svg>
</div>
<div class="onebysign">
<button class="submitBtn">Something</button>
</div>
</div>
</div>
【问题讨论】:
标签: html css svg polygon responsive