当前位置:主页 > 查看内容

左侧固定,右侧自适应(两种方法任选)

发布时间:2021-09-06 00:00| 位朋友查看

简介:第一种方法: !DOCTYPEhtml lang=enheadmeta charset=UTF-8titleDocument/titlestyle.one {position: absolute;height: 200px;width: 300px;background-color: blue;}.two {height: 200px;margin-left: 300px;background-color: red;}/style/headbodydiv cla……

第一种方法:

<!DOCTYPE>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.one {
position: absolute;
height: 200px;
width: 300px;
background-color: blue;
}
.two {
height: 200px;
margin-left: 300px;
background-color: red;
}
</style>
</head>
<body>
<div class="one"></div>
<div class="two">第一种方法</div>
</body>
</html>

第二种方法:

<!DOCTYPE>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.one {
float:left;
height: 200px;
width: 300px;
background-color: blue;
}
.two {
overflow: auto;
height: 200px;
background-color: red;
}
</style>
</head>
<body>
<div class="one"></div>
<div class="two">第二种方法</div>
</body>
</html>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!


原文链接:https://m.jb51.net/css/521284.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐