css左栏固定右栏宽度自适应

快乐打工仔 分类:实例代码

分享一段代码实例,它实现了左栏固定,右栏宽度自适应的功能。

代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style>
.box {
  width: 700px;
  border: 1px solid;
}
.box-left {
  width: 220px;
  background: red;
  height: 300px;
  float: left;
}
.box-right {
  margin-left: 220px;
  background: yellow;
  height: 300px;
}
</style>
</head>
<body>
<div class="box">
  <div class="box-left"></div>
  <div class="box-right"></div>
</div>
</body>
</html>

回复

我来回复
  • 暂无回复内容