下午好,我需要帮助我网站上的菜单。我希望在中间有标题并在侧面弯曲菜单,但它不想做任何事情。请帮忙。颜色仅供测试。我会在发布后更改它们。代码如下。我希望你理解并帮助我解决这个问题。
HTML
@import url('https://fonts.googleapis.com/css?family=Pacifico');
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
vertical-align: center;
}
/* ----- HEADER -----*/
body header {
width: 100%;
height: 90px;
margin: 0;
padding: 0;
background-color: black;
border-bottom: 2px solid #FFFFFF;
box-shadow: 0px 8px 8px 0px rgba(215,223,237,.8);
}
/* ----- HEADER TITLE ----- */
body header .TITLE {
line-height: 90px;
width: 20%;
background-color: aqua;
position: absolute;
left: 40%;
right: 40%;
text-align: center;
}
body header .TITLE h1 {
margin: 0;
font-family: 'Pacifico', cursive;
font-size: 45px;
color: orange;
}
/* ----- HEADER TITLE ----- */
/* ----- HEADER MENU LEFT ----- */
body header .HEADERMENULEFT {
float: left;
}
body header .HEADERMENULEFT ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
body header .HEADERMENULEFT ul li {
flex-grow: 1;
float: right;
text-align: center;
width: 100%;
}
body header .HEADERMENULEFT ul li a {
color: white;
text-decoration: none;
display: block;
/*line-height: 35px;
margin-top: 22px;
background-color: #90afc5;
height: 35px;
margin-left: 50px;
margin-right: 50px;
border-radius: 50px;*/
}
/* ----- HEADER MENU LEFT ----- */
/* ----- HEADER MENU RIGHT ----- */
body header .HEADERMENURIGHT {
float: right;
}
body header .HEADERMENURIGHT ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
body header .HEADERMENURIGHT ul li {
flex-grow: 1;
float: right;
text-align: center;
width: 100%;
}
body header .HEADERMENURIGHT ul li a {
color: white;
text-decoration: none;
display: block;
/*line-height: 35px;
margin-top: 22px;
background-color: #90afc5;
height: 35px;
margin-left: 50px;
margin-right: 50px;
border-radius: 50px;*/
}
/* ----- HEADER MENU RIGHT ----- */
/* ----- HEADER ----- */
<header>
<div class="TITLE">
<h1>MyWeb</h1>
</div>
<div class="HEADERMENULEFT">
<ul>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
</ul>
</div>
<div class="HEADERMENURIGHT">
<ul>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
</ul>
</div>
</header>
答案 0 :(得分:0)
标题中心和左右菜单
@import url('https://fonts.googleapis.com/css?family=Pacifico');
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
vertical-align: center;
}
/* ----- HEADER -----*/
body header {
width: 100%;
height: 90px;
margin: 0;
padding: 0;
background-color: black;
border-bottom: 2px solid #FFFFFF;
box-shadow: 0px 8px 8px 0px rgba(215,223,237,.8);
}
/* ----- HEADER TITLE ----- */
body header .TITLE {
line-height: 90px;
background-color: aqua;
float: left;
text-align: center;
width:20%;
}
body header .TITLE h1 {
margin: 0;
font-family: 'Pacifico', cursive;
font-size: 45px;
color: orange;
}
/* ----- HEADER TITLE ----- */
/* ----- HEADER MENU LEFT ----- */
body header .HEADERMENULEFT {
float: left;
width:40%;
}
body header .HEADERMENULEFT ul {
margin: 0;
padding: 35px 10px;
list-style: none;
display: flex;
}
body header .HEADERMENULEFT ul li {
flex-grow: 1;
float: right;
text-align: center;
width: 100%;
}
body header .HEADERMENULEFT ul li a {
color: white;
text-decoration: none;
display: block;
/*line-height: 35px;
margin-top: 22px;
background-color: #90afc5;
height: 35px;
margin-left: 50px;
margin-right: 50px;
border-radius: 50px;*/
}
/* ----- HEADER MENU LEFT ----- */
/* ----- HEADER MENU RIGHT ----- */
body header .HEADERMENURIGHT {
float: right;
width:40%;
}
body header .HEADERMENURIGHT ul {
margin: 0;
padding: 35px 10px;
list-style: none;
display: flex;
}
body header .HEADERMENURIGHT ul li {
flex-grow: 1;
float: right;
text-align: center;
width: 100%;
}
body header .HEADERMENURIGHT ul li a {
color: white;
text-decoration: none;
display: block;
/*line-height: 35px;
margin-top: 22px;
background-color: #90afc5;
height: 35px;
margin-left: 50px;
margin-right: 50px;
border-radius: 50px;*/
}
&#13;
<header>
<div class="HEADERMENULEFT">
<ul>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
</ul>
</div>
<div class="TITLE">
<h1>MyWeb</h1>
</div>
<div class="HEADERMENURIGHT">
<ul>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
<li><div class="BORDER"><a href="#">TEST</a></div></li>
</ul>
</div>
</header>
&#13;