2 顶部关闭按钮

  • 效果图:


    image.png
  • 素材:


    top.jpg
  • 过程:


    image.png
  • 注意点:

image.png
image.png
  • 代码如下:

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>京东(JD.COM)-正品低价、品质保障、配送及时、轻松购物!</title>
    <link rel="shortcut icon" href="favicon.ico"  type="image/x-icon"/>
    <!-- normalize 里面的css 初始化 针对浏览器 -->
    <link rel="stylesheet" href="css/normalize.css">
    <!-- base里面只写公共样式 是对京东网页 头部和底部样式-->
    <link rel="stylesheet" href="css/base.css">
    <!-- 京东首页的css 只写首页的 独有的-->
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
    <div class="J_event">
        <a href="#" class="w">
            <i></i>
        </a>
    </div>
</body>
</html>
  • base.css
/*版心*/
.w{
    width: 1190px;
    margin: auto;
}
.fr{
    float: right;
}
.fl{
    float: left;
}

/*声明  fonts导入(字体)注意[../fonts/]写法*/
@font-face {
  font-family: 'icomoon';
  src:  url('../fonts/icomoon.eot?etxksv');
  src:  url('../fonts/icomoon.eot?etxksv#iefix') format('embedded-opentype'),
    url('../fonts/icomoon.ttf?etxksv') format('truetype'),
    url('../fonts/icomoon.woff?etxksv') format('woff'),
    url('../fonts/icomoon.svg?etxksv#icomoon') format('svg');
  font-weight: normal;
  font-style: normal;
}



/*京东 顶部 star*/
.J_event{
    height: 80px;
    background-color: #000;
}
.J_event a{
    display: block;
    height: 80px;
    background: url(../images/top.jpg) no-repeat;
    position: relative;  /*子绝父相  */
}
.J_event a i{  /*小×号*/
    width: 20px;
    height: 20px;
    /*background-color: pink;*/
    position: absolute;  /*子绝父相  要以a*/
    right: 0;
    top: 5px;
    font-family: "icomoon";  /*声明字体*/
    font-style: normal;  /*字体不倾斜*/
    text-align: center;  /*水平居中*/
    line-height: 20px;  /*垂直居中*/
    color: #fff;  /*小×号的颜色*/
    background: rgba(0,0,0,0.4);  /*半透明*/
}



/*京东 顶部 end*/
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 第一部分 HTML&CSS整理答案 1. 什么是HTML5? 答:HTML5是最新的HTML标准。 注意:讲述HT...
    kismetajun阅读 28,018评论 1 45
  • 1 错误认知 “爱一个人”并不是有以下权力:(1)要求他也爱你;(2)控制他的思想行为;(3)要求他照顾你的人生快...
    子嫣_阅读 2,726评论 0 1
  • As always, all things win. Your 一如既往,万事胜意。
    落蓝音阅读 1,111评论 0 0