2 回答

TA貢獻1942條經驗 獲得超3個贊
嘗試使用 CSS 網格進行此類布局。 CSS 網格使得創建這樣的布局變得非常容易。 這是使用 CSS 網格的基本布局。
body {
display:grid;
grid-template-areas:
"h h"
"c f";
}
nav {
grid-area: c;
box-sizing: border-box;
background-color: #409fff;
/* display: inline-block; */
/* width: 20%; */
min-width: 125px;
/* margin-right: 15px; */
height: 100vh;
}
nav a {
display: block;
line-height: 45px;
height: 45px;
color: #ffffff;
/* background-color: #486b02; */
/* text-decoration: none; */
/* background-color: #486b02; */
/* padding-left: 50px; */
margin: 10px 0 10px 5px;
}
header {
grid-area: h;
margin: 0;
padding: 0;
box-sizing: border-box;
/* display: inline-block; */
background: #409fff;
text-align: center;
float: right;
}
h1 {
margin: 0;
padding: 0;
/* box-sizing:border-box; */
display: inline;
color: #ffffff;
font-family: sans-serif, Arial, "Times New Roman";
}
main {
grid-area:f;
background-color: yellow;
}
input,
textarea {
border-radius: 5px;
}
- 2 回答
- 0 關注
- 174 瀏覽
添加回答
舉報