官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 同心县| 静宁县| 宜良县| 分宜县| 宜昌市| 湖南省| 肇东市| 班戈县| 陇南市| 尖扎县| 威远县| 瑞安市| 湖口县| 阿瓦提县| 绥江县| 陆良县| 雷山县| 洪江市| 汉中市| 颍上县| 宝兴县| 红桥区| 孟州市| 元谋县| 南开区| 南皮县| 奉化市| 双峰县| 瑞丽市| 府谷县| 图片| 那坡县| 洪湖市| 从化市| 仙游县| 江都市| 康平县| 永登县| 金川县| 济源市| 富顺县|