css中font怎么用

這篇文章將為大家詳細講解有關css中font怎么用,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)服務項目包括平泉網(wǎng)站建設、平泉網(wǎng)站制作、平泉網(wǎng)頁制作以及平泉網(wǎng)絡營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關系等,向廣大中小型企業(yè)、政府機構等提供互聯(lián)網(wǎng)行業(yè)的解決方案,平泉網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務的客戶以成都為中心已經(jīng)輻射到平泉省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!

CSS字體屬性定義文本的字體系列、大小、加粗、風格(如斜體)和變形(如小型大寫字母)font-family控制字體,由于各個電腦系統(tǒng)安裝的字體不盡相同,但是基本裝有黑體、宋體與微軟雅黑這三款字體。

font-size控制字體大小,我們設置字體大小是設置它的寬度,它的高度一般電腦系統(tǒng)默認字體大小是16px,所以字體大小盡量不要低于16px,1em=16px;

font-weight: bold;/*控制字重 一般是100-900 常用lighter(細體) normal(正常)bold加粗 */

至于這個font-style,一般默認是normal,也就是正常的,如果說你設置 font-style: italic;斜體話,其實和這個<em></em>的效果是差不多的;文字間的間距用的line-height如果和高度相等話,就是垂直居中了。

通常font字體的簡寫:font:style weight size/line-heigt font-family  /*要求必須出現(xiàn)的2個是 size與font-family*/

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>css常用樣式font字體的多種變換</title>
    <style>
        div{
            font-family: 'Microsoft YaHei';/*微軟雅黑*/
            /* font-family: 'Lucida Sans','Lucida Sans Regular', 
            'Lucida Grande', 'Lucida Sans Unicode', Geneva,
             Verdana, sans-serif; */
            /*字體加上雙引號或者單引號,當有多個字體的時候,中間逗號分開*/
            color:#f90;
            font-size: 24px;/*控制字體大小*/
            font-weight: bold;
            /*控制字重 常用lighter(細體) normal(正常)bold加粗 */
            font-style: italic;/*等同于em*/
            line-height: 30px;
        }
        /*font字體的簡寫:font:style weight size/line-heigt font-family*/
        /*要求必須出現(xiàn)的2個是 size font-family*/
        p{  
            font: 24px/1.5em 'Lucida Sans','Lucida Sans Regular',
             'Lucida Grande', 'Lucida Sans Unicode', 
             Geneva, Verdana, sans-serif;
            letter-spacing: 1px;/*英文字母間距*/
            word-spacing: 10px;/*英文單詞間距*/
        }
        P::first-letter{
            text-transform: capitalize;
        }/*第一個字母::first-letter*/
        p::first-line{
            color:red;
        }/*第一行::first-line*/
    </style>
</head>
<body>
    <div>技術為王世界,欲問青天山頂景色是否獨好技術為王世界,
    欲問青天山頂景色是否獨好技術為王世界,欲問青天山頂景色是否獨好技術為王世界,
    欲問青天山頂景色是否獨好技術為王世界,欲問青天山頂景色是否獨好技術為王世界,
    欲問青天山頂景色是否獨好技術為王世界,
        欲問青天山頂景色是否獨好技術為王世界,欲問青天山頂景色是否獨好 </div>
    <p>Technology is king world, I want to ask if the scenery on 
    the top of Qingtian Mountain is the king of technology, 
        I want to ask whether the scenery of Qingtian Peak is 
        the king of technology. If the technology is the king of the world, 
        I would like to ask whether the scenery on the top of 
        Qingtian Mountain is the king of the world. Is the scenery good?</p>
</body>
</html>

關于樣式繼承問題/*與文字有關樣式會被繼承下去*/代碼展示如下:

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <style>
        p{
            font-size: 20px;
            font-family: 微軟雅黑;    
            color:#f00;
            font-weight:bold;
            font-style:italic;
            word-spacing:15px;
        }

    </style>
</head>
<body>
    <div>
        <p><span>linux php linux</span></p>
        <p><span>linux linux php linux</span></p>
        <p><span>linux linux php linux</span></p>
        <p><span>linux linux php linux</span></p>
    </div>    
</body>
</html>

關于“css中font怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

當前標題:css中font怎么用
網(wǎng)站地址:http://www.muchs.cn/article30/iidgpo.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、手機網(wǎng)站建設、網(wǎng)站制作、標簽優(yōu)化、移動網(wǎng)站建設全網(wǎng)營銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化