html+css 两栏布局

在开发中页面布局经常用到的两栏布局。

html:

<!DOCTYPE html>
<html>
<head>
    <title></title>
<link rel="stylesheet" href="1.css">
<style type="text/css">

</style>
</head>

<body>
    <div class="right"></div>//细节问题,一定将right布局放在left前面
    <div class="left"></div>
</body
</html>

css:

*{
    padding: 0;
    margin: 0;
}
.left{
    background-color: #f40;
    margin-right: 100px;
    height: 100px;
}
.right{
    width: 100px;
    height: 100px;
    background-color: #ccc;
    position: absolute;
    right: 0;
}

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_39396275/article/details/81180546