【发布时间】:2015-08-11 16:12:16
【问题描述】:
使侧边栏固定在左侧并同时使网站的其余部分以全宽(减去侧边栏宽度,例如 100px)浮动到右侧的最佳 css 方法是什么。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Title of the document</title>
</head>
<body>
<div class="sidebar">
Should be fixed, full height, 160px Width.
</div>
<div class="page-wrapper">
Should be full width minus the sidebar width
</div>
</body>
</html>
谢谢。
【问题讨论】:
-
.sidebar{ 宽度:160px;高度:100vh;填充:20px 0;向左飘浮; z 指数:10;位置:固定; }
-
但是对于页面包装器,我不知道如何使它向右移动,并且是全宽减去侧边栏宽度。注意:我不想正确使用浮动
-
你不介意我向你展示使用引导程序还是你想让我使用纯 css?