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

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:

主站蜘蛛池模板: 海兴县| 蒙城县| 巴马| 阿图什市| 和田县| 乐昌市| 宣威市| 梁山县| 庆城县| 长治县| 集安市| 永安市| 松潘县| 潞西市| 昆明市| 巴青县| 九寨沟县| 合阳县| 城固县| 封开县| 娄底市| 上栗县| 天气| 四会市| 嘉禾县| 隆回县| 东至县| 广灵县| 大关县| 酒泉市| 淮北市| 托克逊县| 塘沽区| 新乡县| 武安市| 武冈市| 遵化市| 龙门县| 尉犁县| 石门县| 泸溪县|