麻烦老师检查是否有误和需要修改的地方
来源:4-6 自由编程
dww1
2021-11-16 01:21:27
<!-- 网页的头部包含logo和导航条 --> <header> <div class="header-top"> <!-- 网页的logo --> <div class="logo"> <h1>Gareer Builder</h1> </div> <!-- 网页的导航条 --> <nav> <ul> <li><a href=""> HOME</a></li> <li><a href=""> ABOUT</a></li> <li><a href=""> GALLERY</a></li> <li><a href=""> FACULTY</a></li> <li><a href=""> EVENTS</a></li> <li><a href=""> CONTACT</a></li> </ul> </nav> </div> </header> <!-- banner区域 --> <section class="banner"> <!-- 图片 --> <img class="banner-img" src="images/banner3.jpg" alt=""> <!-- 遮罩层 --> <div class="hidden"></div> <div class="center"> <!-- 表单区域 --> <form action=""> <input type="text" placeholder="your Name"> <input type="text" placeholder="your Phone"> <input type="email" placeholder="your Email"> <textarea name="" id="" cols="50" rows="5" placeholder="Write your Comment Here"></textarea> <input type="submit" value="SEND MESSAGE"> </form> </div> </section>
*{
margin: 0;
padding: 0;
}
/* 去掉ul和ol的小圆点 */
ul,ol{
list-style: none;
}
/* 去掉超级链接的下划线 */
a{
text-decoration: none;
}
/* 头部 */
header{
/* 不设置宽度 自动撑满 */
background-color: #07cbc9;
}
header .header-top{
width: 1200px;
height: 80px;
margin: 0 auto;
}
header .header-top .logo{
float: left;
/* 不设置宽度 自动撑满 */
height: 48px;
text-align: center;
line-height: 48px;
/* 有上下的padding */
padding: 16px 0;
color: #fff;
}
header .header-top .logo h1{
height: 48px;
}
/* 导航条 */
header .header-top nav{
height: 48px;
float: right;
padding-top: 16px;
}
header .header-top nav ul{
height: 48px;
}
header .header-top nav ul li{
float: left;
height: 48px;
margin-right: 20px;
text-align: center;
line-height: 48px;
}
header .header-top nav ul li a{
display: block;
height: 48px;
color: #fff;
}
header .header-top nav ul li a:hover{
background-color: gold;
color: #000;
}
/* banner区域 */
section.banner{
/* 宽度100% */
width: 100%;
position: relative;
}
section.banner img.banner-img{
/* 宽度100% */
width: 100%;
height: 600px;
}
section.banner .hidden{
width: 100%;
height: 600px;
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
}
section.banner .center{
width: 520px;
height: 360px;
position: absolute;
top: 50%;
margin-top: -180px;
left: 50%;
margin-left: -260px;
}
section.banner .center form{
position: absolute;
width: 504px;
height: 350px;
left: 50%;
/* 表单整体水平居中 */
margin-left: -252px;
/* 按钮水平居中显示 */
text-align: center;
}
section.banner .center form input{
width: 502px;
height: 38px;
border: 1px solid #808080;
/* 去除边框背景 */
background: none;
margin-bottom: 20px;
color: #808080;
/* 去除鼠标点击时的外围线 */
outline: none;
}
section.banner .center form textarea{
width: 504px;
height: 110px;
margin-bottom: 20px;
/* 去除背景 */
background: none;
/* 去除鼠标点击时外围线 */
outline: none;
color: #808080;
}
section.banner .center form input:nth-of-type(4){
width: 200px;
height: 40px;
margin: 0 auto;
}1回答
好帮手慕星星
2021-11-16
同学你好,样式优化:
1、from表单设置的固定高度有些小了,建议去掉高度,让内容撑起来即可

2、.center盒子已经设置了定位,from不需要再次设置定位了,用margin:0 auto;实现水平居中

祝学习愉快!
相似问题