html 在頭像旁邊 兩行文字

效果預(yù)覽:


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>

使用網(wǎng)格布局,頭像可能有點外,設(shè)置position: relavite然后調(diào)整,包攬它的div記得設(shè)overflow: hidden

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容