【发布时间】:2022-01-17 02:10:57
【问题描述】:
我有这样的 html 和 css 代码。我有两个问题:
- 当窗口宽度为 600px 时,理论上左框应该是 150px 宽度,因为它是 parent(600px)的 25%,但宽度是 120px。
- 右框无法达到100vw。它只需要
widthOfParent-widthOfLeft。我想它应该以某种方式溢出并达到 100vw。
<div class="container">
<div class="left"></div>
<div class="right"></div>
</div>
* {
margin: 0;
padding: 0;
}
.container {
height: 300px;
/* your code here */
display: flex;
justify-content: start;
}
.left {
background-color: #f44336;
height: 100%;
width: 25%;
min-width: 100px;
}
.right {
background-color: #2973af;
height: 100%;
width: 100vw;
}
codesanbox:https://codesandbox.io/s/admiring-darkness-cu99x?file=/src/styles.css:0-293
【问题讨论】:
标签: html css user-interface flexbox frontend