How to set line spacing and word spacing?

Setting the distance between the word line spacing and will need css style. With line-heightthe pitch line is provided; with letter-spacingspacing setting word. details as follows:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>设置行间距</title>
<style>
    .p1{line-height: 30px;}
    .p2{line-height: 12px;}
</style>
</head>
<body>
    <p class="p1">斯蒂芬·库里(Stephen Curry),1988年3月14日出生于美国俄亥俄州阿克伦(Akron,Ohio),美国职业篮球运动员,司职控球后卫,效力于NBA金州勇士队。</p>
    <p class="p2">斯蒂芬·库里于2009年通过选秀进入NBA后一直效力于勇士队,新秀赛季入选最佳新秀第一阵容;2014-15、2016-17、2017-18赛季三次随勇士队获得NBA总冠军;两次当选常规赛MVP,两次入选最佳阵容第一阵容,5次入选全明星赛西部首发阵容。</p>
</body>
</html>

Results are as follows: Here Insert Picture Description
Note: If the line spacing than the set character size is smaller, the overlap may occur.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>设置字间距</title>
<style>
    .p1{letter-spacing: 5px;}
    .p2{letter-spacing: 1em;}
</style>
</head>
<body>
    <p class="p1">斯蒂芬·库里(Stephen Curry),1988年3月14日出生于美国俄亥俄州阿克伦(Akron,Ohio),美国职业篮球运动员,司职控球后卫,效力于NBA金州勇士队。</p>
    <p class="p2">斯蒂芬·库里于2009年通过选秀进入NBA后一直效力于勇士队,新秀赛季入选最佳新秀第一阵容;2014-15、2016-17、2017-18赛季三次随勇士队获得NBA总冠军;两次当选常规赛MVP,两次入选最佳阵容第一阵容,5次入选全明星赛西部首发阵容。</p>
</body>
</html>

Results are as follows: Here Insert Picture Description
Note: 1.em is the relative length unit. Text objects relative to the current font size.
2. Allow the use of a negative value. If you use a negative value, then the word will overlap. It is generally used to achieve a negative overlap of text effects.

Published 15 original articles · won praise 26 · views 7684

Guess you like

Origin blog.csdn.net/Big_eyes123/article/details/84258361