段落排版--中文字間距、字母間距(letter-spacing, word-spacing)


中文字間隔、字母間隔設置:

如果想在網頁排版中設置文字間隔或者字母間隔就可以使用    letter-spacing 來實現,如下面代碼:

h1{
    letter-spacing:50px;
}
...
<h1>了不起的蓋茨比</h1>

注意:這個樣式使用在英文單詞時,是設置字母與字母之間的間距。

單詞間距設置

如果我想設置英文單詞之間的間距呢?可以使用 word-spacing 來實現。如下代碼:

h1{
    word-spacing:50px;
}
...
<h1>welcome to here!</h1>

示例:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>字間距</title>
<style type="text/css">
    h1{letter-spacing:20px;font-size:20px;}
    p{word-spacing:20px;}
    #pp{letter-spacing:20px;
</style>
</head>
<body>
    <h1>hello world, hello rinpe !</h1>
    <hr/>
    <p>hello world, hello rinpe !</p>
    <hr/>
    <p id="pp">我的名字叫xxxxx</p>
</body>
</html>

效果:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM