原图:

Image

作品效果:

Image

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a {
            display: block;
            /*将链接转换为块元素 */
            width: 230px;
            height: 40px;
            background-color: #535758;
            font-style: 14px;
            color: #ffffff;
            text-decoration: none;
            text-indent: 2em;
            line-height: 40px;
        }

        a:hover {
            background-color: #ff6f00;
        }

        /* 文字垂直居中技巧 */
        /* 文字行高等于盒子宽度 */
        /* a {
            line-height: 40;
        } */
    </style>

</head>

<body>
    <!-- 思路:
    把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>
</body>

</html>

让文字垂直居中技巧

Image

下载链接:

小米侧边栏.html