該示例基於由ng init
創建的默認Angular 2骨架。Angular 2中的組件高度爲100%
讓我們假設我想讓我的主要組件用藍色背景填充整個屏幕。
app.component.css:
my_component_div {
background-color:lightblue;
height:100%;
}
(全球)styles.css的:
html, body {
height: 100%;
margin:0; padding:0;
}
這是結果:
我不想要一個滾動條。我不喜歡滾動條。爲什麼有滾動條?爲什麼頂部有白色邊框?根據檢查(see screenshot),這個填充餘量在頂部的東西是體外,但裏面的html。這個完全基本的功能如何實現?