侧边栏 - I
Coddy 侧边栏|前端项目 课程的第 6 课,共 13 课。
挑战
简单对于 'sidebar' 类,设置以下属性:
1. 将宽度设为 250 像素,高度设为 100%。
2. 将背景颜色设为你喜欢的颜色。
3. 将 position 设为 fixed。
4. 将 box-sizing 设为 border-box。
亲手试试
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>Sidebar</title>
</head>
<body>
<button id="openSidebarBtn">Open</button>
<div id="sidebar" class="sidebar">
<button id="closeSidebarBtn">Close</button>
<p>Home</p>
<p>About</p>
<p>Services</p>
<p>Contact</p>
</div>
<script src="script.js"></script>
</body>
</html>侧边栏|前端项目中的所有课
自己练习: Web 在线编辑器