自己摸爬滚打做了一天,特别是被margin,padding,border折磨得欲仙欲死的时候,我也没放弃,还是做完了,在各位大佬看来可能跟老太婆的裹脚布一样又臭又长,但我会继续努力的。如果有人能指出一些建议就更好了
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>仿百度首页</title>
<style>
*{
padding: 0;
margin: 0;
}
body{
text-align: center;
}
.header{
margin-top: 10px;
height: 5px;
width: 100%;
}
.left{
text-align: left;
display: inline-block;
width: 20%;
/*background-color: brown;*/
/*position: relative;*/
float: left;
}
.right{
width: 80%;
/*background-color: burlywood;*/
text-align: right;
/*position: relative;*/
display: inline-block;
/*margin-right:20%;*/
float: right;
}
/*display-inline:把多个div可以显示在一行*/
a{
margin: 8px;
}
.mainbody{
/*background-color: aliceblue;*/
margin-top: 50px;
height: 500px;
width: 100%;
}
img{
padding-top: 0;
height: 129px;
width: 270px;
}
.search{
left: 25%;
position: absolute;
display: block;
width: 1000px;
/*background-color: darkorange;*/
}
#inputk{
/*background-color: deeppink;*/
display: inline;
position: relative;
width: 500px;
height: 38px;
margin-top: 20px;
float: left;
border: 1px solid gray;
font-size: 16px;
}
#inputk:hover{
border: 1px solid #3388FF;
}
#btn{
width: 100px;
height: 40px;
display: inline;
color: #fff;
border: none;
outline: none;
cursor: pointer;
font-size: 16px;
margin-top: 20px;
background-color: #3388FF;
float: left;
}
</style>
</head>
<body>
<div class="header">
<div class="left">
<a href="http://1.163.com/" id="left">1元夺宝</a>
</div>
<div class="right">
<a href="https://www.nuomi.com">糯米</a>
<a href="http://news.baidu.com/">新闻</a>
<a href="https://www.hao123.com/">hao123</a>
<a href="http://map.baidu.com/">地图</a>
<a href="http://v.baidu.com/">视频</a>
<a href="https://tieba.baidu.com">贴吧</a>
</div>
</div>
<div class="mainbody">
<img src="百度图标.png" alt="百度图标">
<div class="search">
<div id="input">
<input type="text" id="inputk">
</div>
<input type="button" id="btn" value="百度一下">
</div>
</div>
<div id="footer">
版权所有@编程界的的一股清流<br>
©2016 Baidu
</div>
</body>
</html>