- Cross-platform Desktop Application Development:Electron,Node,NW.js,and React
- Dmitry Sheiko
- 134字
- 2021-07-15 17:36:25
Sticking the title bar and header
The layout looks fine without any content, but what happens to the layout if it receives content that is too long?

In fact, we will have a header and footer shifting out of the view when scrolling. It doesn't look user-friendly. Fortunately, we can change it easily using another fresh addition to CSS called Sticky positioning (https://www.w3.org/TR/css-position-3/#sticky-pos).
All we need to do is to modify slightly the title bar component:
./assets/css/Component/titlebar.css
.titlebar {
...
position: sticky;
top: 0;
}
and the footer:
./assets/css/Component/footer.css
.footer {
...
position: sticky;
bottom: 0;
}
In the preceding code, we declared that the title bar will stick to the top and footer to the bottom. Run the application now, and you will note that both boxes are always visible, regardless of scrolling:

推薦閱讀
- ExtGWT Rich Internet Application Cookbook
- Intel Galileo Essentials
- Monkey Game Development:Beginner's Guide
- 造個小程序:與微信一起干件正經事兒
- Pandas Cookbook
- Backbone.js Blueprints
- Python:Master the Art of Design Patterns
- Learning FuelPHP for Effective PHP Development
- Visual Basic程序設計實驗指導(第二版)
- UI設計全書(全彩)
- Django實戰:Python Web典型模塊與項目開發
- Web App Testing Using Knockout.JS
- PHP+MySQL動態網站開發從入門到精通(視頻教學版)
- Magento 2 Beginners Guide
- Java從入門到精通(視頻實戰版)