前端学习笔记之4 静态页面练习(百度)

引言 : 博主目前是一名iOS开发者, 所会的语言有Objective-C 和 Swift, 目前正在学习前端; 这篇文章只是作为我的笔记发在这里, 供自己业余时间看看; 全是很基础的东西, 看到的小伙伴 酌情略过 吧^_^

效果图

这里写图片描述

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">更多产品</a>
    </div>
    <!--主要内容-->
    <div id="content">
        <div class="logo">
            <img src="images/logo.png">
        </div>
        <div class="search">
            <input type="text" value="">
            <a href="#">百度一下</a>
        </div>
        <div class="dom">
            <img src="images/d_1.JPEG">
            <img src="images/d_2.JPEG">
            <img src="images/d_3.JPEG">
            <img src="images/d_4.JPEG">
        </div>
        <div class="dom">
            <img src="images/d_5.JPEG">
            <img src="images/d_6.JPEG">
            <img src="images/d_7.JPEG">
            <img src="images/d_8.JPEG">
        </div>
    </div>
    <!--尾部-->
    <div id="footer">
        <p class="footer-top">
            <a href="#">把百度设置为主页</a>
            <a href="#">关于百度</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;
}

/*主要内容*/
#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;
}
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值