• 小米商城侧边栏【显示向右箭头】


    一、方法1:添加图片

    显示效果:
    在这里插入图片描述
    向右箭头我 图片是来自:iconfont-阿里巴巴矢量图

    DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>小米商城导航侧边栏title>
        <style>
            #nav {
                background-color: #9e9c9d;
                width: 250px;
                height: 430px;
                /*距离上个盒子的上边有10px*/
                padding-top: 10px;
                 /*距离上个盒子的底部有10px*/
                padding-bottom: 10px;
            }
    
            a {
                display: block;
                background-color: #9e9c9d;
                width: 250px;
                height: 42px;
                color: #edeeee;
                text-decoration: none;
                /* 单行文字垂直居中 */
                line-height: 42px;
                text-indent: 2em;
                background-image: url(arrow-right.png);
                /*背景图片位置*/
                background-position: center right;
                /*背景图片是否平铺*/
                background-repeat: no-repeat;
                /*背景图片大小*/
                background-size: 16px;
                /*背景图片x轴的距离*/
                background-position-x: 210px;
            
            }
    
            a:hover {
                background-color: #ff6700;
            }
        style>
    head>
    
    <body>
        <div id="lyx">
            <div id="nav">
                <a href="#">手机a>
                <a href="#">电脑 a>
                <a href="#">笔记本 平板a>
                <a href="#">家电 a>
                <a href="#">出行 穿戴a>
                <a href="#">智能 路由器a>
                <a href="#">电源 配件 a>
                <a href="#">健康 儿童a>
                <a href="#">耳机 音箱 a>
                <a href="#">生活 箱包 a>
            div>
        div>
    body>
    
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65

    二、方法2:直接添加“❯”符号的编码\276F,利用伪类选择器

    显示效果:
    在这里插入图片描述

    DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Documenttitle>
        <link rel="stylesheet" href="style.css">
        <style>
            a {
                display: block;
                text-decoration: none;
                width: 250px;
                height: 42px;
                background-color: rgb(133, 128, 128);
                color: rgb(253, 247, 247);
                line-height: 42px;
                text-indent: 2em;
            }
    
            a:hover {
                background-color: rgb(223, 115, 27);
            }
    
            .nav::after {
                content: '\276F';
                font-size: 20px;
                float: right;
                padding-right: 40px;
            }
        style>
    head>
    
    <body>
        <div>
            <a href="#">
                手机
                <span class="nav">
                span>
            a>
            <a href="#">
                电脑 笔记本
                <span class="nav">
                span>
            a>
            <a href="#">
                家电 洗衣机
                <span class="nav">
                span>
            a>
        div>
    
    body>
    
    html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
  • 相关阅读:
    Salesforce ServiceCloud考证学习(1)
    双态IT乌镇大会 | 首批《数据中心业务连续性等级评价准则》试点单位将诞生
    308节---------6月26日
    合宙Air101 的LCD怎么用Arudino IDE驱动
    第七天项目实战二
    解决TP6使用PHPExcel导出excel文件时报错
    Unity之C#脚本学习笔记
    docker查看jvm内存占用
    Inbound marketing的完美闭环:将官网作为营销枢纽,从集客进化为入站
    什么是BFC
  • 原文地址:https://blog.csdn.net/m0_47010003/article/details/126897497