CSS小技巧

#小技巧

文字两边对齐

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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
div{
border:1px solid;
font-size:20x;
}

span{
border:1px solid red;
display: inline-block;
text-align:justify;
width:100px;
line-height: 20px;
overflow: hidden;
height: 20px;
}

span:after{
content:" ";
display: inline-block;
width:100%;
border:1px solid blue;
}
</style>
</head>
<body>
<div>
<span>姓名</span><br>
<span>联系方式</span>
</div>
</body>
</html>

多出文字省略

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
div{
border: 1px solid red;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div>
1 3 4 5 6 7 8 9 0 - 1 2 3 4 5 6 7 8 90 - 1 3 4
6 7 8 90 - 1 2 3 4 5 6 7 8 9 0 -
</div>
</body>
</html>

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
,