gpt4 book ai didi

css - 列下推 css 问题

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

我在网上搜索过,但找不到答案。希望有人帮助我出。

在我的页面中,右栏被向下推到左栏下方,因为宽度问题。有什么办法我不需要改变所有的宽度元素?我的意思是让右栏与类所在的 div 重叠包装器?

有我的html页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>My first styled page</title>
<style type="text/css">

body {
color: purple;
}

div.wrapper {
width: 80%;
border-style:solid;
border-color:black;
}

div.one {
width: 300px;
float: left;
height: 300px;
border-style:solid;
border-color: #0000ff;
}

div.two {
width: 1024px;
border-style:solid;
border-color:yellow ;
}

</style>
</head>
<body>
<div class="wrapper">
<div class="one">The left column</div>
<div class="two">The right column</div>
</div>
?
</body>

这是我的页面的屏幕截图: enter image description here

最佳答案

解决方案:

<!DOCTYPE HTML>
<html>
<head>
<title>My first styled page</title>
<style type="text/css">
body {
color:purple;
}
div.wrapper {
width:80%;
float:left;
border-style:solid;
border-color:black;
}
div.one {
width:45%;
float:left;
height:300px;
border:1px solid blue;
}
div.two {
width:45%;
float:right;
border:1px solid yellow;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="one">The left column</div>
<div class="two">The right column</div>
</div>
</body>
</html>

结果:
enter image description here

关于css - 列下推 css 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16780524/

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