使用CSS設置行間距,字間距


原鏈接:http://blog.sina.com.cn/s/blog_a03d702f01013u3q.html

字間距
1、text-indent設置抬頭距離css縮進

即對,對應div設置css樣式text-indent : 20px; 縮進了20px

2、letter-spacing來設置字與字間距_字符間距離,字體間距css樣式

即對對應div設置css屬性樣式為letter-spacing:8px;,字間距為8px

行間距

在CSS中,可以設置行間距,格式如下:
標簽名{line-height:參數}

根據參數不同有3種方法:
1.用數字參數設置:
   行間距=字號×參數
2.用單位參數設置:
   行間距=參數
3.用比例參數設置:
   行間距=字號×參數

實例:

1.用數字參數設置:

程序代碼

<html>
<style type="text/css">
<!--
    body{font-size:12pt;line-height:3}
    
-->
</style>
<head>
     <title>CSS</title>
</head>
<body>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!
</body>
</html>

 



2.用單位參數設置:

程序代碼

<html>
<style type="text/css">
<!--
    body{font-size:12pt;line-height:3pt}
    
-->
</style>
<head>
     <title>CSS</title>
</head>
<body>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!
</body>
</html>

 


3.用比例參數設置:

 程序代碼

<html>
<style type="text/css">
<!--
    body{font-size:12pt;line-height:200%}
    
-->
</style>
<head>
     <title>CSS</title>
</head>
<body>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!<br>
     Welcome to Magci's BLOG!
</body>
</html>

 


免責聲明!

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



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