如何创建一个固定的div和第二个可滚动的div?

我是 UI 新手,使用 Bootstrap4 在 HTML 中创建一个博客布局,我正在遵循此布局...“已删除”,如何创建第一个 div 固定和第二个可滚动,然后创建一个全宽横幅等等。



慕容3067478
浏览 85回答 1
1回答

摇曳的蔷薇

在此处发布问题之前,您需要先尝试一些操作,然后如果您遇到困难,可以在此处发布问题以获得答案。第一步:您需要学习 HTML 和 CSS 的基础知识。(https://www.w3schools.com/html/html_css.asp)要使某个部分固定,您需要使用 CSS 中的 POSITION 属性。(https://www.w3schools.com/css/css_positioning.asp)我想这些已经足够你开始了。快乐学习!

吃鸡游戏

div class="container-fluid">&nbsp; &nbsp; <div class="w-100 bg-dark" style="height: 50px;">&nbsp; &nbsp; </div>&nbsp; &nbsp; <div class="row" >&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-6 bg-primary" style="height: 50vh;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="position-fixed bg-danger">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-6 bg-secondary " style="height: 100vh;">&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; </div></div>不要忘记输入高度和宽度 /// 其他,我认为更好的方法:<div class="container-fluid"><div class="row">&nbsp; &nbsp; <aside class="col-2 px-0 fixed-top bg-danger">&nbsp; &nbsp; </aside>&nbsp; &nbsp; <main class="col offset-2 h-100">&nbsp; &nbsp; </main></div>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5