html 在头像旁边 两行文字

2020-07-24  本文已影响0人  半栈

效果预览:


image.png

代码:

<!--
 * @Author: your name
 * @Date: 2020-07-24 11:24:02
 * @LastEditTime: 2020-07-24 13:45:48
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
-->
<!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 scoped>
        .main {
            display: grid;
            width: 200px;
            grid-template-columns: 50px 70px 20px;
            font-size: 10px;
        }

        .col-1 img {
            display: inline-block;
            position: relative;
            top: 5px;
        }

        .col-1 {
            margin: auto 0;
            overflow: hidden;
        }

        .col-2 {
            height: 50px;
            display: grid;
            grid-template-rows: 20px 20px;
            line-height: 28px;
        }

        .col-3 {
            text-align: center;
            margin: auto 10px;
        }
    </style>
</head>

<body>
    <div class="main">
        <div class="col-1">
            <img src="./assets/头像.svg">
        </div>
        <div class="col-2">
            <span>admin</span>
            <span>施工员-项目部</span>
        </div>
        <div class="col-3">
            <img src="./assets/箭头.png">
        </div>
    </div>
</body>

</html>

使用网格布局,头像可能有点外,设置position: relavite然后调整,包揽它的div记得设overflow: hidden

上一篇下一篇

猜你喜欢

热点阅读