SOURCE

console 命令行工具 X clear

                    
>
console
window.addEventListener('load', function () {
    var goBack = document.querySelector('.goBack');
    // 点击goBack图片,滚动窗口至页面最上方
    window.addEventListener('scroll', function () {
        if (window.pageYOffset >= 100) {
            // console.log(window.pageYOffset);
            // 当头部被卷去 >520px 显示goBack返回顶部图片
            // page.style.width = '500px';
            goBack.style.display = 'block';
        } else {
            goBack.style.display = 'none';
        }
    });
    // 点击goBack图片,滚动窗口至页面最上方
    goBack.addEventListener('click', function () {
        window.scroll(0, 0);
    });
})
<body>
	<div class="page">
        <div class="inner">
            <div class="cont">
                <div class="goBack"></div>
                <h1 class="title"><span>品优购列表页制作</span></h1>
            </div>

            <div class="cont">
                <!-- 品优购列表页制作准备工作 -->
                <div class="w">
                    <h3>
                        <span></span>
                        <span>品优购列表页制作准备工作</span>
                    </h3>
                    <ol>
                        <li><p>列表页面是新的页面,我们需要新建页面文件<code>list.html</code></p></li>
                        <li><p>因为列表页的<code>头部</code><code>底部</code>基本一致,所以我们需要把首页中的头部和底部的结构复制过来</p></li>
                        <li><p>头部和底部的样式也需要,因此<code>list.html</code>中还需要引入<code>common.css</code></p></li>
                        <li><p>需要新的<code>list.html</code>样式文件,这是列表页专门的样式文件 </p></li>
                    </ol>                   
                </div>

                <!-- 品优购列表页头部和导航栏 -->
                <div class="w">
                    <h3>
                        <span></span>
                        <span>列表页header和nav修改</span>
                    </h3>
                    <figure>
                        <img src="https://img-blog.csdnimg.cn/c22ff1f9b553460ab3c94ff31476bfd6.png" alt="">
                    </figure>
                    <ul>
                        <li><p>秒杀盒子<code>sk(seckill)</code>定位即可</p></li>
                        <li><p>1号盒子左侧浮动<code>sk_list</code>里面包含<code>ul</code><code>li</code></p></li>
                        <li><p>2号盒子左侧浮动<code>sk_con</code>里面包含<code>ul</code><code>li</code></p></li>
                    </ul>
                </div>

                <!-- 列表页主体sk_container -->
                <div class="w">
                    <h3>
                        <span></span>
                        <span>列表页主体sk_container</span>
                    </h3>
                    <figure>
                        <img src="https://img-blog.csdnimg.cn/0e35cfb95f9d46f7b0672a7283560d0b.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAaW1CeXRl,size_20,color_FFFFFF,t_70,g_se,x_16" alt="">
                    </figure>
                    <ul>
                        <li><p>1号盒子<code>sk_container</code>给宽度 1200,不要给高度</p></li>
                        <li><p>2号盒子<code>sk_hd</code>,插入图片即可</p></li>
                        <li><p>3号盒子<code>sk_bd</code>,里面包含很多的<code>ul</code><code>li</code></p></li>
                        <li><p>3号盒子<code>sk_bd</code>里面没有高度,里面的子元素又有浮动效果,所以要给浮动的元素的父元素加<i>清除浮动</i></p></li>
                        <li><p>3号盒子<code>sk_bd</code>里面子盒子原先是没有边框的,当鼠标经过时需要添加边框,会出现内容往下抖动的问题,<i>完美写法应该是给子元素原先的盒子添加一个透明的边框</i></p></li>
                        <li><p>3号盒子<code>sk_bd</code>里面子盒子每个都添加了<code>margin-right</code>,每列最后一个不需要填加,利用结构伪类选择器<code>nth-child(4n)</code>,代表4的倍数,完美解决</p></li>
                    </ul>                   
                </div>
            </div>
        </div>
    </div>
</body>
/*---------------------------------------------------------- Normalized.css ------------------------------------------------------------------------------*/
* {
    margin: 0;
    padding: 0;
    outline: 0;
    box-sizing: border-box;
}
/* 左浮动 */
.fl {
    float: left;
}
/* 右浮动 */
.fr {
    float: right;
}
/* 清除浮动 */
.clear:after {
    visibility: hidden;
    clear: both;
    display: block;
    content: '';
    height: 0
}
.clear {
    *zoom: 1;
}
/* 去除 链接下划线 */
a {
    color: #333;
    text-decoration: none;
}
/* li {
    list-style: none;
} */
i,
em {
    font-style: normal;
}
i {
    color: #c81623;
}
b {
    color: #135ce0;
}
strong {
    color: #373737;
}
/* 去除图片 空白缝隙 */
img {
    border: 0;
    vertical-align: middle;
}
input {
    outline: none;
}
button {
    cursor: pointer;
}
/* 返回顶部按钮 */
div.goBack {
    display: none;
    /* 固定定位和父级没有关系,它以屏幕为准 */
    position: fixed;
    bottom: 22px;
    /* 水平居中 */
    left: 50%;
    transform: translateX(-50%);
    /* 版心宽度一般距离 */
    margin-left: 358px;
    /* 固定的盒子必须有宽度 */ 
    width: 26px;
    height: 26px;
    background: url(https://g.csdnimg.cn/side-toolbar/3.4/images/fanhuidingbucopy.png) no-repeat;
    background-size: cover;
    /* 压住其他所有盒子 */
    z-index: 999;
}

/*---------------------------------------------------------- index.css ------------------------------------------------------------------------------*/

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui,-apple-system,BlinkMacSystemFont,Helvetica Neue,PingFang SC,Hiragino Sans GB,Microsoft YaHei UI,Microsoft YaHei,Arial,"\5B8B\4F53",sans-serif;
    /* 抗锯齿 让文字显示的更清晰 */
    -webkit-font-smoothing: antialiased;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    text-underline-position: under;
    text-decoration-skip-ink: none;
    background-color: #fff;
}

/* 最外层内边距 */
.page {
    position: relative;
    word-wrap: break-word;
    hyphens: auto;
    background-color: #fff;
    padding: calc(10px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 0 calc(20px + env(safe-area-inset-left));  
}
/* 版心 */
.inner {
    position: relative;
    max-width: 677px;
    margin-left: auto;
    margin-right: auto; 
    zoom: 1; 
}

/* 标题区域 */
.inner .title {
    font-size: 22px;
    line-height: 1.4;
    margin-bottom: 15px;  
    text-align: center; 
}
.inner .title span {
    padding: 0 0 10px;
    border-bottom: 3px solid rgb(32, 87, 146);   
}
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    font-size: 16px;
}

/* 内容区域 */
.cont {
    visibility: visible;
    position: relative;
    overflow: auto;
    color: #222;
    font-size: 17px;
    word-wrap: break-word;
    hyphens: auto;
    text-align: justify;
    z-index: 0; 
}
.cont * {
    max-width: 100%!important;
    box-sizing: border-box!important;
    -webkit-box-sizing: border-box!important;
    word-wrap: break-word!important;       
}

/* 内容文本区域 */
.cont .w {
    position: relative;
    font-size: 16px;
    color: black;
    margin-bottom: 15px;
    padding-right: 10px;
    padding-left: 10px;
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: left;
    line-height: 1.25;
    letter-spacing: 2px;
    font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
    visibility: visible;
    border: 1px solid transparent;
}
.cont .w:last-child {
    margin-bottom: 100px;
}

/* h3 副标题 */
.cont h3 {
    margin-top: 20px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #373737;
    font-size: 18px;
    visibility: visible;
}
.cont h3 span:nth-child(1) {
    position: absolute;
    left: -1px;
    margin-top: 2px;
    width: 4px;
    height: 20px;
    background-color: rgb(199, 29, 35);
    border-radius: 2px;
    display: block;
    float: left;
    visibility: visible    
}
.cont h3 span:nth-child(2) {
    margin-left: 0px;
    line-height: 26px;
    visibility: visible;   
}

/* 段落文本 p */
.cont p {
    margin-left: 1px;
    margin-right: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 26px;
    font-size: 14px;
    word-spacing: 2px;
    color: rgb(55, 55, 55);
    text-align: justify;
    visibility: visible;
    min-height: 1em;    
}

/* 列表 */
.cont ul {
    padding-left: 42px;
    font-size: 14px;  
}
.cont ul li p {
    line-height: 35px;
    word-spacing: 2px;
    margin-left: 5px;
    margin-right: 8px;
    padding: 0;
}
.cont ol {
    padding-left: 48px;
    font-size: 14px;  
}
.contol li p {
    line-height: 35px;
    word-spacing: 2px;
    margin-left: -2px;
    margin-right: 8px;
    padding: 0;   
}
/* 列表里面包含的列表 */
.cont ul ul li {
    list-style: disc;
}
.cont ol ul li {
    list-style: disc;
}

/* 表格 */
.cont .table-box {
    overflow-x: auto;
}
.cont table {
    display: table;
    width: 100%;
    max-width: 600px !important;
    margin: 0 auto 15px;
    border-collapse: collapse;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 14px; 
}
.cont table tr {
    text-align: left;
    border-top: 1px solid #dfe2e5;
}
.cont table tr td:nth-child(1) {
    white-space: nowrap;
}
/* .cont table tr td:nth-child(2) {
    white-space: nowrap;
} */
.cont table th {
    color: #135ce0; 
    font-size: 17px;
    white-space: nowrap;
}
.cont table th,
.cont table td {
    border: 1px solid #dfe2e5;
    padding: 9px 20px;
}
.cont table td p {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    text-indent: 0;
    margin: 0;
    padding: 0;
}
.cont table td p:nth-child(n+2) {
    margin: 10px 0 0 0;
}

/* 图片 */
.cont figure {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 15px auto 15px;
    visibility: visible;
}
.cont figure img {
    box-shadow: rgb(55 55 55 / 12%) 2px 4px 6px 0px;
    border-radius: 8px;
    visibility: visible !important;
    height: auto !important;
    width: 600px !important;
}

/* 链接 */
.cont .link {
    margin: 20px 0;
}
.cont .link a {
    padding: 10px 16px;
    font-size: 13px;
    color: white;
    background-color: #e9686b;
    border-radius: 8px;
}

/* 引用快 */
.cont blockquote {
    color: rgb(106, 115, 125);
    margin: 15px 8px 20px;
    padding: 16px;
    border-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left: 3px solid #DBDBDB;
    border-color: rgb(199, 29, 35);
    border-radius: 8px;
    box-shadow: rgb(199 29 35) 8px 8px 0px;
    background: rgb(255, 255, 255);   
}
.cont blockquote p {
    font-size: 14px;
    word-spacing: 2px;
    line-height: 26px;
    color: rgb(55, 55, 55);
    text-align: left;    
}

/* pre */
.cont pre {
    margin: 10px auto 10px;
    border-radius: 5px;
    box-shadow: none !important;
    position: relative;
    overflow-x: auto;
    padding: 8px 16px;
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 13px;
    color: #abb2bf; 
    text-align: left;
    line-height: 24px;
    letter-spacing: 0px;
    -webkit-overflow-scrolling: touch;
    background: #272822;
    white-space: pre;
}

/* code 代码块 */
.cont code {
    font-size: 14px;
    overflow-wrap: break-word;
    font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
    word-break: break-all;
    color: rgb(199, 29, 35);
}

/* 文字样式 */
.t0 {
    color: #3f9cd6 !important;
}
.t1 {
    color: #dcce80 !important;
}
.t2 {
    color: #7cdcfe !important;
}
.t3 {
    color: #b5ce9b !important; 
}
.t4 {
    color: #ce9178 !important;
}
.t5 {
    color: #c678dd !important;
}
.t6 {
    color: #ff8c00 !important;
}
.t8 {
    color: #de645b !important;
}
.t9 {
    color: #4a892d !important;
}

/*---------------------------------------------------------- media.css ------------------------------------------------------------------------------*/
@media screen and (max-width: 500px) {
    /* html {
        -webkit-text-size-adjust: 100%;
    } */
    .cont .w p {
        font-size: 16px;
    }
    .cont .w ul li p,
    .cont .w ol li p {
        font-size: 14px;
    }
    .cont ol p code, 
    .cont ul p code {
        font-size: 14px;
    }
    .cont ol p a,
    .cont ul p a, {
        font-size: 14px;
    }
    .cont .w table td p {
        font-size: 14px;
    }
    .cont .w table code {
        font-size: 14px;
    }
    .cont .w blockquote p {
        font-size: 14px;  
    }
    .cont p code {
        font-size: 16px;
    }
    div.goBack {
        margin-left: 238px !important;
        background-size: 70% 70%;
    }
}