CSS 样式简写

在CSS中有许多简写的样式,它们被广泛使用。简写最好按照如下顺序进行书写

font

font: font-style font-weight font-size/line-height font-family
font-style
italic//斜体
normal//正常字体(默认)
font-weight
一般填写数字
400 normal(默认值)
700 bold(默认值)
font-size
16px(默认值)
font-family
直接填写字体名称即可如 `MicroSoft Yahei`

div{
	font: italic 700 14px/20px 'Microsoft Yahei';
}

注意 不需要的属性可以省略(取默认值),但是必须保留font-size和font-family属性,否则font属性将不会生效

background

background: background-color background-image background-repeat background-attachment background-position
背景颜色 背景图片 背景平铺 背景固定 背景图片位置

background: transparent url(images/male.png) no-repeat fixed center center;

同样的对于你不需要的属性可以省略不写

border

border: border-width border-style border-color

border: 1px solid red;

表格

        <table>
            <thead> //表明是表头
                <tr> //一行
                    <th>姓名</th> //一个单元格
                    <th>性别</th>
                    <th>电话</th>
                </tr>
            </thead>
            <tbody> //非表头部分
                <tr>
                    <td>李白</td>
                    <td>男</td>
                    <td>18681282718</td>
                </tr>
                <tr>
                    <td>小美</td>
                    <td>女</td>
                    <td>15228578292</td>
                </tr>
            </tbody>
        </table>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值