gpt4 book ai didi

html - 使用 % 宽度、最小/最大宽度和 100% 高度的 float div(响应式)

转载 作者:太空狗 更新时间:2023-10-29 16:47:40 25 4
gpt4 key购买 nike

我有 2 个 div,一个需要固定宽度,另一个响应用户设备。目前,当低于一定宽度时, float 的 div 会跳到单独的行上。有没有办法...

1) 使它们都成为 body 高度的100%

2) 保持在同一行上,这样右侧的 div 可以缩小宽度,而左侧的 div 保持最小/最大宽度?

另外,70% 的正确 div 永远不会填满可用空间的全部 70%。

我意识到我正在尝试做的事情有点自相矛盾,但想不出解决办法。

http://jsfiddle.net/establish/fxQfv/

HTML

<article>
</article>

<section>
</section>

CSS

article  { 
background: blue;
float: left;
height: 100px;
width: 30%;
min-width: 200px;
max-width: 200px;
}

section {
background: red;
float: left;
height: 100px;
width: 70%;
}

最佳答案

http://jsfiddle.net/fxQfv/3/

article  { 
background: blue;
height: 100px;
width: 30%;
float:left;
min-width: 200px;
max-width: 200px;
}

section {
background: red;
height: 100px;
width: auto;
}

关于你的高度问题,看看这篇文章:http://www.alistapart.com/articles/fauxcolumns/

关于html - 使用 % 宽度、最小/最大宽度和 100% 高度的 float div(响应式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10146262/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com