【XHTML&CSS读书笔记】大小写、行高、粗体和斜体

《HTML之路》第1、2章 笔记


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <title>Case, line-height, bold and italics</title>
    <style type="text/css" media="all">
    
    body {
        /*
        font属性的快捷写法:这个属性的值是:
        font-style,font-variant,font-weight,font-size,line-height和font-family的组合,
        只有font-size和font-family是必须的  
        */
        font: 150% arial, helvetica, sans-serif;
    }

    /*
    id选择符用于唯一地标识文档某部分内容,在HTML文档中,同一个id只能使用一次
    这里的#p3是id选择符,通过id将样式绑定到相应的对象上
    */ 
    #p3 {
        font-variant: small-caps; /*将小写字母转为小个的大写字母*/
    }
    
    #p4 {
        text-transform: uppercase;/*将小写字母转为大个的大写字母*/
    }

    /*
    class选择符用于标识文档某部分内容,在HTML文档中,同一个class名可以被使用无数次
    这里的.p5是class选择符,通过class名将样式绑定到相应的对象上
    */
    .p5 {
        line-height: 5.5;
        color: blue;
        font-weight: bold; 
    }

    /*
    在这里em是HTML选择符,指定一个css规则应用到某个对象上
    */
    em { 
        font-style: italic; /* generally unnecessary because the default style of em tends to be italic */
    }
    
    strong {
        font-weight: bold; /* again unnecessary - the default style of strong tends to be bold */
    }
    
    </style>
</head>

<body>

<p id="p3">The <strong>green</strong> seed of the white-flowering climbing leguminous papilionaceous plant, <em>pisum sativum</em>, has become a dining-table favourite for good reason.</p>

<p id="p4">The <strong>perfect</strong> accompaniment to any meal, the diminutive spherical vegetable brings joy to billions worldwide, be they fresh, frozen, canned or dried.</p>

<p class="p5">This a wonderful day!</p>

</body>
</html>


运行结果:





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值