html往下滑变成水平,HTML - 水平滑块CSS最佳方法_html_开发99编程知识库
由於每個部分的位置已經(jīng)設(shè)置為relative,意味著將relative定位到上一節(jié),因此可以將其他部分設(shè)置為left: 0 。
* {
margin: 0;
}
#all-sections{
display:inline-flex;
}
.main, .about, .professional, .fun-stuff, .blog, .contact{
height:100vh;
position: relative;
left: 0
display:block;
width:100vw;
}
.main{
background-color:white;
}
.about{
background-color:red;
}
.professional{
background-color:purple;
}
.fun-stuff{
background-color:black;
}
.blog{
background-color:blue;
}
.contact{
background-color:rgb(1, 235, 21);
}
About
Professional
Fun Stuff
Blog
Contact
如果希望導(dǎo)航欄始終可見,可以將該元素設(shè)置為position: fixed,它不會在滾動時移動。
#menu-list {
position: fixed;
z-index: 9999;
}
* {
margin: 0;
}
#all-sections{
display:inline-flex;
}
.main, .about, .professional, .fun-stuff, .blog, .contact{
height:100vh;
position: relative;
left: 0
display:block;
width:100vw;
}
.main{
background-color:white;
}
.about{
background-color:red;
}
.professional{
background-color:purple;
}
.fun-stuff{
background-color:black;
}
.blog{
background-color:blue;
}
.contact{
background-color:rgb(1, 235, 21);
}
About
Professional
Fun Stuff
Blog
Contact
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的html往下滑变成水平,HTML - 水平滑块CSS最佳方法_html_开发99编程知识库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机 注册表 远程桌面,仅允许运行使用
- 下一篇: html js清除缓存,js清除浏览器缓