HTML+CSS培训教案(十一)

二十六、文字样式与排版

  1. font-family:文字字体

    Arial,“Times New Roman”——使用Arial字体,若不存在则找Times New Roman字体
  2. font-style:倾斜效果

    (1)normal(default):不倾斜(默认选项)

    (2)oblique:物理右倾15度

    (3)italic:使用斜体字体库
  3. font-weight:加粗效果

    (1)normal(default):不加粗(默认选项)

    (2)blod/bloder:加粗

    (3)lighter:使字体变细

    (4)100-900(整百数):可控制加粗程度
  4. text-transform:英文大小写转换

    (1)capitalize:首字母大写

    (2)uppercase:全部大写

    (3)lowercase:全部小写
  5. font-size:字体大小

    (1)xxpx:以像素为单位

    (2)xxem:以字符高度为单位

    (3)xx%:大小是原来的百分之几
  6. 文字下沉

代码

<html>
    <head>
        <meta content="text/html;charset=utf-8">
        <title>文字下沉</title>
        <style>
        p span{font-size:2em;float:left;}
        </style>
    </head>
    <body>
        <h2>Forget buggy Windows 10, Windows 11 is the operating system we want</h2>
        <p id="p1"><span>W</span>indows 10 is a very good operating system, but the October 2018 Update has left a bad taste in many users' mouths. It caused a multitude of problems, got pulled, and even after it was made available again, new issues surfaced. The April 2018 Update rolled out to users at lightning speed, but the October 2018 Update has only been installed on about 3 percent of systems to date. Ouch.</p>
        <p id="p2"><span>M</span>icrosoft has said previously that Windows 10 will be the "last version of Windows", but is it time to rethink that idea and give users an operating system that goes up to 11? Take a look and make up your own mind.</p>
    </body>
<html>
  1. text-decoration:文字装饰

    (1)none:无任何装饰

    (2)underline:下划线

    (3)line-throght:中划线

    (4)overline:顶划线

    (5)blink:文字闪烁,仅部分浏览器支持
  2. 首行缩进与悬挂缩进

代码

<html>
    <head>
        <meta content="text/html;charset=utf-8">
        <title>首行缩进与悬挂缩进</title>
        <style>
        p span{font-weight:bold;}
        #p1{text-indent:2em;}
        #p2{text-indent:-2em;padding-left:2em;}
        </style>
    </head>
    <body>
        <h2>Forget buggy Windows 10, Windows 11 is the operating system we want</h2>
        <p id="p1"><span>W</span>indows 10 is a very good operating system, but the October 2018 Update has left a bad taste in many users' mouths. It caused a multitude of problems, got pulled, and even after it was made available again, new issues surfaced. The April 2018 Update rolled out to users at lightning speed, but the October 2018 Update has only been installed on about 3 percent of systems to date. Ouch.</p>
        <p id="p2"><span>M</span>icrosoft has said previously that Windows 10 will be the "last version of Windows", but is it time to rethink that idea and give users an operating system that goes up to 11? Take a look and make up your own mind.</p>
    </body>
<html>
  1. 字词间距

    (1)word-spacing:词间距

    (2)letter-spacing:字母间距(中文中的单字间距)
  2. line-height:行高

    (1)xxpx:长度

    (2)xx(数值):倍数

    (3)xx%:百分比
  3. 段间距

    margin:(上下塌,左右加)
  4. text-align:水平对齐

    (1)left:左对齐

    (2)center:居中对齐

    (3)right:右对齐

    (4)justify:两端对齐
  5. 文字颜色和背景颜色

    (1)color:前景色(文字颜色)

    (2)background[-color]:背景色
  6. vertical-align:垂直对齐

    (1)top:上对齐

    (2)middle:居中对齐

    (3)bottom:下对齐
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值