gpt4 book ai didi

css - 调整大小时稳健的页面布局

转载 作者:太空宇宙 更新时间:2023-11-03 18:50:21 25 4
gpt4 key购买 nike

我目前在我的页面上有两个 div,它们大约位于中左,并且它们都向左浮动。我的问题是,当我调整页面大小时使其变小时,右边的 div 会下沉到左边的 div 下方,我希望它保持在另一个 div 旁边的位置。

什么 CSS 魔术可以让我做到这一点? (如果有的话)

最佳答案

您好,请检查以下相应代码,它会对您有所帮助....

<html>
<head>
<style type="text/css">
#left {
border:1px solid red;
width:40%;
height:auto;
float:left;
}
#right {
border:1px solid blue;
width:40%;
height:auto;
float:left;
}
</style>
</head>
<body>
<div id="left">
<h1>Sample 1</h1>
<h1>Sample 1</h1>
<h1>Sample 1</h1>
<h1>Sample 1</h1>
</div>
<div id="right">
<h1>Sample 2</h1>
<h1>Sample 2</h1>
<h1>Sample 2</h1>
<h1>Sample 2</h1>
</div>
</body>
</html>

关于css - 调整大小时稳健的页面布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15151031/

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