引言 : 博主目前是一名iOS開發(fā)者, 所會的語言有Objective-C 和 Swift, 目前正在學習前端; 這篇文章只是作為我的筆記發(fā)在這里, 供自己業(yè)余時間看看; 全是很基礎的東西, 看到的小伙伴 酌情略過 吧_
效果圖
這里寫圖片描述
1. index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>百度一下,你就知道</title>
<link href="css/index.css" rel="stylesheet">
</head>
<body>
<!--頭部-->
<div id="header">
<!--javascript:void(0) 點擊的時候啥也不干-->
<a href="#">新聞</a>
<a href="#">hao123</a>
<a href="#">地圖</a>
<a href="#">視頻</a>
<a href="#">貼吧</a>
<a href="#">登錄</a>
<a href="#">新聞</a>
<a href="#" class="more-product">更多產(chǎn)品</a>
</div>
<!--主要內(nèi)容-->
<div id="content">
<div class="logo">
![](images/logo.png)
</div>
<div class="search">
<input type="text" value="">
<a href="#">百度一下</a>
</div>
<div class="dom">
![](images/d_1.JPEG)
![](images/d_2.JPEG)
![](images/d_3.JPEG)
![](images/d_4.JPEG)
</div>
<div class="dom">
![](images/d_5.JPEG)
![](images/d_6.JPEG)
![](images/d_7.JPEG)
![](images/d_8.JPEG)
</div>
</div>
<!--尾部-->
<div id="footer">
<p class="footer-top">
<a href="#">把百度設置為主頁</a>
<a href="#">關(guān)于百度</a>
<a href="#">About Baidu</a>
</p>
<p class="footer-bottom">
@2017 Baidu <a href="#">使用百度前必讀</a> 意見反饋 京ICP證18264號
</p>
</div>
</body>
</html>
2. index.css
* {
margin: 0px;
padding: 0px;
}
body {
/*背景圖片, 其中 ../ 是返回到上一層目錄*/
/*background: url("../images/d_1.JPEG");*/
}
/*頭部*/
#header{
text-align: right;
height: 30px;
line-height: 30px;
margin-top: 1px;
}
#header a{
margin: 0px 15px 0px 0px;
}
#header a.more-product{
display: inline-block;
color: white;
background-color: rgb(51, 136, 255);
height: 30px;
line-height: 30px;
padding: 0px 20px;
text-decoration: none;
margin-right: 0px;
}
/*主要內(nèi)容*/
#content{
text-align: center;
}
#content .logo img{
width: 270px;
height: 129px;
margin: 15px auto 0px;
}
#content .search {
width: 600px;
height: 40px;
margin: 0px auto;
margin-bottom: 40px;
}
#content .search input{
width: 500px;
height: 40px;
padding: 9px 7px;
border: solid rgb(204, 204, 204) 1px;
margin: 0px;
/*向外擴展*/
box-sizing: border-box;
}
/*焦點*/
#content .search input:focus{
outline: none;
border: solid 1px rgb(51, 136, 255);
}
#content .search a {
display: inline-block;
color: white;
background-color: rgb(51, 136, 255);
width: 100px;
height: 40px;
line-height: 40px;
text-decoration: none;
text-align: center;
float: right;
}
/*鼠標放上去的時候*/
#content .search a:hover {
background-color: rgba(51, 136, 255, 0.7);
}
#content .dom img {
width: 150px;
height: 100px;
margin: 5px 10px;
}
/*鼠標放上去的時候*/
#content .dom img:hover{
/*設置不透明度*/
opacity: 0.7;
}
/*尾部*/
#footer{
margin-top: 120px;
text-align: center;
}
#footer p{
margin-top: 5px
}
#footer p.footer-top{
margin: 0px 5px;
}
a:hover {
opacity: 0.7;
}