gpt4 book ai didi

html - 屏幕分辨率问题

转载 作者:太空宇宙 更新时间:2023-11-04 15:22:28 25 4
gpt4 key购买 nike

我在对索引页进行编码后遇到了这个问题。我将页面分为两列:

header

nav

content floating left, content floating right

footer

在我的屏幕分辨率上,我已正确对齐:

Content left | Content right

但是在小屏幕上,它看起来像这样:

Content left
Content right

这是代码:

    <div id="contentleft">
text & content left
</div>
<div id="contentright">
text & content right
</div>

CSS:

 #contentleft {
float:left;
margin-left:12%;}

#contentright {
float:right;
margin-right:12%;}

非常感谢帮助

最佳答案

当没有足够的空间容纳它们时, float 将换行。您的 css 已将宽度设置为自动扩展到内容。

 #contentleft {
float:left;
margin-left:12%;
width:38%; // note margins grow the width of divides
}

#contentright {
float:right;
margin-right:12%;
width:37%; // note on odd width screen some browsers IE rounds up so 100%/2 + 100%/2 = 101% according to microsoft.
}

关于html - 屏幕分辨率问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7352770/

25 4 0
文章推荐: html - HTML 表格中的空格?
文章推荐: javascript - 使用 CSS 通过
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com