css怎么样有下划线然后让文字在最右边

css怎么样有下划线然后让文字在最右边,css怎么样有下划线然后让文字在最右边

img

1、下划线可以设置盒子元素的下边框实现(如果标签元素属于行内元素,可设置元素display: inline-block;width: 100px; 实现)
2、文字居右采用 text-align: right; 来实现

<!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>
        * {
            padding: 0;
            margin: 0;
        }
        .line {
            padding: 2px 0;
            font: normal 18px/30px PingFangSC;
            text-align: right;
            border-bottom: 1px solid saddlebrown;
            color: burlywood;
        }
    </style>
</head>
<body>
    <div class="line">05/01/2022 15:47:30</div>
</body>
</html>

效果:

img

text-decoration: black;
text-align: right;