【发布时间】:2021-04-04 17:09:00
【问题描述】:
我正在学习前端开发,任务是制作带有图像的对角 div。我做到了,在 Firefox 中它看起来很棒,但是当我在 Chrome 中打开它时,它显示不正确。
可能是什么原因?如何在 Chrome 中修复它?
菲福克斯:
铬:
到目前为止,我是这样做的:
.container {
display: flex;
margin: 0;
padding: 0;
max-width: 100%;
background-color: green;
height: 300px;
}
.red-div {
background-color: red;
width: calc(50% - 50px);
box-sizing: border-box;
}
.orange-div {
width: calc(50% + 50px);
height: 100%;
background: orange;
box-sizing: border-box;
border-left: 100px solid red;
border-bottom: 327px solid transparent;
background: url("https://picsum.photos/id/1/800/800");
background-size: 527px;
background-position: -200px 0;
}
<div class="container">
<div class="red-div">Test</div>
<div class="orange-div"></div>
</div>
【问题讨论】:
-
在 SVG 中可能更简单
标签: html css google-chrome firefox frontend