

准备写一个侧导航的,但是呈现出来的效果确是换行的,这是为什么
这个情况是因为div的css样式有问题 ;在css样式中有position,它可以把div修改:
可以看看:
https://www.runoob.com/w3cnote/css-position-static-relative-absolute-fixed.html
如果你的测导航需要固定到页面:
position: fixed
例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fixed Div Example</title>
<style>
.fixed-div {
position: fixed;
top: 10px;
right: 10px;
width: 200px;
height: 100px;
background-color: #333;
color: white;
padding: 10px;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="fixed-div">
我是固定在页面上的div。
</div>
</body>
</html>
```html