校园网开发问题

校园网开发问题

图片本来是居中好的

http://img1.sycdn.imooc.com//climg/6020e2ef09ca219a00000000.jpg


后面想加右侧两个绿色的框

加了之后图片就被挤到左面了,

http://img1.sycdn.imooc.com//climg/6020e32409a2408e15650613.jpg


请问怎么调整

我试了很多都不行

html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>校园网首页开发lding</title>
<script src="js/js.js"></script>
<link rel="stylesheet" href="css/css.css">
</head>
<body>
<div class="header">
<div class="logo">
<img src="image/logo.png">
</div>
<div class="function">
<ul>
<li id="f1"><a href="#" onmouseover="show('f1')" onmouseleave="show1('f1')">HOME</a></li>
<li id="f2"><a href="#" onmouseover="show('f2')" onmouseleave="show1('f2')">ABOUT</a></li>
<li id="f3"><a href="#"onmouseover="show('f3')" onmouseleave="show1('f3')">GALLERY</a></li>
<li id="f4"><a href="#"onmouseover="show('f4')" onmouseleave="show1('f4')">FACULTY</a></li>
<li id="f5"><a href="#"onmouseover="show('f5')" onmouseleave="show1('f5')">EVENTS</a></li>
<li id="f6"><a href="#"onmouseover="show('f6')" onmouseleave="show1('f6')">CONTACT</a></li>
</ul>
</div>
</div>
<div class="banner">
<div class="banner-img">
<img src="image/banner3.jpg">
</div>
<div class="textdiv">
<ul>
<li><input type="text" id="text1" class="text" value="your Name"></li>
<li><input type="text" id="text2" class="text" value="your Phone"></li>
<li><input type="text" id="text3" class="text" value="your Email"></li>
<li><textarea rows="10" cols="30" id="text4">
Write Your Comment Here</textarea></li>
<li><button id="btn" type="submit" value="SEND MESSAGE">SEND MESSAGE</button></li>

</ul>
</div>

</div>
<div class="about">
<div class="about-h"><h2>LDing</h2></div>
<div class="bottom"></div>
<div class="content1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting</p>
<p> industry.Lorem Ipsum has been the industry's standard dummy</p>
<p> text ever since the 1500s. </p>
</div>
<div class="content2-img">
<img src="image/bb3.jpg">
<div class="content3-div">

</div>
<div class="content4-div">

</div>
</div>

</div>
<div class="gallery">

</div>
<div class="footer">

</div>
</body>
</html>

css

​*{
margin: 0px;
padding: 0px;
}
.header{
width: 100%;
height: 60px;
background-color: #07cbc9;
}
body{
font-family: Microsoft YaHei UI;
font-size: 14px;
}
.header .logo{

float: left;
position: relative;
margin-top: 6px;
margin-left: 100px;
}
.header .function ul{
float: right;
margin-right: 60px;
}
.header a{
text-decoration: none;
color: white;
font-size: 10px;
font-weight: bold;
}

.header .function ul li{
float: left;
margin-right: 5px;
line-height: 59px;
list-style: none;
background-color:#07cbc9;
padding-left: 10px;
padding-right: 10px;
}

.banner{
margin-top: 0px;
width: 100%;
height: 400px;
}
.banner .banner-img img{
width:100%;
height: 500px;
z-index: 10;
float: left;
position: relative;
filter:contrast(80%);
filter:brightness(70%);
opacity: 0.9;
}

.banner .textdiv ul li .text{
width: 400px;
height: 30px;
list-style: none;
background-color: transparent;
/*border-width: medium;*/
border: 1px solid #ccc;
outline: none;
color: darkgray;
font-family: Microsoft YaHei UI;
font-size: 10px;
}
.banner .textdiv ul li .text:hover {
border: 1px solid #07cbc9;
}
.banner .textdiv ul li #text4{
height: 100px;
width: 400px;
text-align: left;
background-color: transparent;
vertical-align:top;
border: 1px solid darkgray;
outline: none;
color: darkgray;
font-family: Microsoft YaHei UI;
font-size: 10px;

}
.banner .textdiv ul li #text4:hover{
border: 1px solid #07cbc9;
}
.banner .textdiv ul li{
margin-bottom: 15px;

}
.banner .textdiv{
width: 100%;
height: 400px;
z-index: 20;
margin-top: 50px;
/*background-size:contain;*/
/*background: url(../image/banner3.jpg);*/
/*background-repeat: no-repeat;*/
float: left;
position: absolute;
text-align: center;

}
.banner .textdiv ul{
margin-top: 60px;
}
.banner .textdiv #btn{
height: 30px;
width: 130px;
background-color: transparent;
border: 1px solid darkgray;
outline: none;
color: darkgray;
font-family: Microsoft YaHei UI;
font-size: 15px;
}
.banner .textdiv #btn:hover{
border: 1px solid #07cbc9;
}
body{
overflow: auto;
}
.about{
margin: 150px auto;
text-align: center;
}
.about .about-h{

font-family: Microsoft YaHei UI;
font-size: 25px;
font-weight: bold;
margin: 50px auto 10px auto ;
text-align: center;
/*border-bottom: #07cbc9 3px solid ;*/
/*width: 30px;*/
/*padding-bottom: 20px;*/
/*width: 30px;*/
}
.about .bottom{
border-bottom: #07cbc9 2px solid;
width: 30px;
margin: 20px auto;
}
.about .content1{
font-family: Microsoft YaHei UI;
font-size: 8px;
color: gray;
line-height: 20px;
}
.about .content2-img img{
width: 422px;
height: 282px;
margin-right: 30px;


/*position: absolute;*/
}
.about .content3-div{
float: right;
width: 150px;
height: 150px;
border: #07cbc9 solid 1px;
margin-right: 500px;

}
/*.about .content4-div{*/

/* width: 150px;*/
/* height: 150px;*/
/* border: #07cbc9 solid 1px;*/

/*}*/


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕阿园 2021-02-08 17:24:50

同学你好,同学可以参考如下代码,可以使用定位,设置具体的宽度,然后使其居中;如下

http://img1.sycdn.imooc.com//climg/602102d709d2875203020135.jpg

祝学习愉快~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星

相似问题

登录后可查看更多问答,登录/注册

请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师