所以我有 5 个三角形图像在 div 中彼此相邻嵌套。我只是希望图像在窗口调整大小时调整大小,或者只是在不同分辨率下保持一定的纵横比。我目前有固定的宽度,但 100% 接受替代方法来使其工作,甚至是正确的方法。
HTML
<div id="projects">
<div id="project_1">
<div id="snitch">
<img class="tribox1" src="" />
<img class="tribox2" src="" />
<img class="tribox3" src="" />
<img class="tribox4" src="" />
<img class="tribox5" src="" />
</div>
</div>
<div id="project_2">
<div id="snitch">
<img class="tribox1" src="" />
<img class="tribox2" src="" />
<img class="tribox3" src="" />
<img class="tribox4" src="" />
<img class="tribox5" src="" />
</div>
</div>
<div id="project_3">
<div id="snitch">
<img class="tribox1" src="" />
<img class="tribox2" src="" />
<img class="tribox3" src="" />
<img class="tribox4" src="" />
<img class="tribox5" src="" />
</div>
</div>
<div id="project_4">
<div id="snitch">
<img class="tribox1" src="" />
<img class="tribox2" src="" />
<img class="tribox3" src="" />
<img class="tribox4" src="" />
<img class="tribox5" src="" />
</div>
</div>
<div id="project_5">
<div id="snitch">
<img class="tribox1" src="" />
<img class="tribox2" src="" />
<img class="tribox3" src="" />
<img class="tribox4" src="" />
<img class="tribox5" src="" />
</div>
</div>
</div>
CSS
body {
background-color: #1b1b1b;
margin: 0;
padding: 0;
overflow: hidden ;
position: relative;
-webkit-transition: left .2s ease;
top:0px;
left:0px;
bottom:0px;
width: 9800px;
}
#projects {
padding-top: 3.085%;
}
#project_1, #project_2, #project_3, #project_4, #project_5 {
float: left;
}
#snitch {
width: 1960px;
}
.tribox1 {
background-repeat: no-repeat;
background-position: bottom;
padding-top: 5px;
}
.tribox2 {
background-repeat: no-repeat;
background-position: left center;
margin-left: -498px;
}
.tribox3 {
background-repeat: no-repeat;
background-position: center;
margin-left: -501px;
}
.tribox4 {
background-repeat: no-repeat;
background-position: right center;
margin-left: -500px;
}
.tribox5{
background-repeat: no-repeat;
background-position: bottom right;
margin-left: -464px;
padding-top: 51px;
}