老师麻烦您帮忙看一下代码正确性和规范性
具体遇到的问题
老师麻烦您帮忙看一下代码正确性和规范性
报错信息的截图
相关课程内容截图
尝试过的解决思路和结果
按钮这里我设置了text-align: center; 没有起到效果,请问老师这里应该怎么写呢
粘贴全部相关代码,切记添加代码注释(请勿截图)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>banner4_6</title>
<link rel="stylesheet" href="css/banner4_6.css">
</head>
<body>
<div class="banner">
<img class="banner-img" src="images/banner3.jpg" alt="">
<div class="imgShade"></div>
<form>
<input type="text" placeholder="your Name">
<input type="tel" placeholder="your Phone">
<input type="email" placeholder="your Email">
<textarea placeholder="Write Your Comment Here"></textarea>
<button type="submit">SEND MESSAGE</button>
</form>
</div>
</body>
</html>
* {
padding: 0;
margin: 0;
}
.banner {
width: 100%;
height: 600px;
position: relative;
}
.banner .banner-img {
position: absolute;
width: 100%;
height: 600px;
}
.banner .imgShade {
position: absolute;
width: 100%;
height: 600px;
background: rgba(0, 0, 0, .5);
}
.banner form {
width: 504px;
background: none;
position: absolute;
top: 100px;
left: 50%;
margin-left: -252px;
}
.banner form input {
width: 504px;
height: 40px;
margin-bottom: 20px;
border: 1px solid #808080;
background: none;
color: white;
}
.banner form textarea {
width: 504px;
height: 110px;
margin-bottom: 20px;
background: none;
border: 1px solid #808080;
}
.banner form button {
width: 200px;
height: 40px;
background: none;
border: 1px solid #808080;
color: #808080;
/* text-align: center; */
left: 50%;
margin-left: 150px;
}
15
收起
正在回答
1回答
同学你好,代码写的很规范哦。不过代码实现的效果中有一个小问题,表单整体没有被父元素包裹住,如下:
这是因为表单里的元素的宽度是504px,但是里面的表单元素都有border边框值,所以按照盒模型计算(504+border左右边框)=506px,如下图:
参考下图修改:
祝学习愉快!
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星