前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CSS3 text 学习笔记

CSS3 text 学习笔记

作者头像
LRainner
发布2020-07-15 15:53:25
2940
发布2020-07-15 15:53:25
举报
文章被收录于专栏:安全学习笔记安全学习笔记

CSS3 text属性

  • text-align(文本对齐方式)
  • text-decoration(添加文本修饰)
  • text-indent(首行缩进)
  • text-shadow(设置阴影)
  • line-height(设置行高)
  • letter-sapcing(设置字符间距)

text.html

代码语言:javascript
复制
  <head>
    <title>text</title>
    <link rel="stylesheet" href="style_text.css" type="text/css" />
  </head>
  <body>
    <h2>Hello World</h2>
    <p>无穷的远方,无数的人们,都与我有关,很高兴和你建立这份连结。</p>
  </body>

text-align

  • 规定文本的水平对齐方式
  • 默认值由浏览器决定
  • 可能的值:left(左对齐),right(右对齐),center(居中),justify(两端对齐)

style_text.css

代码语言:javascript
复制
h2 {
  text-align: center;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: bold;
  font-style: italic;
}
p {
  text-align: center;
  font-style: italic;
  font-weight: bold;
}

text-decoration

  • 规定添加到文本的修饰
  • 默认值为none
  • 可能的值:none,underline(下划线),overline(上划线),line-through(删除线),blink(闪烁的文本)

text-indent

  • 规定首行缩进
  • 可能的值:固定的缩进(默认为0)

text-shadow

  • 设置文本阴影
  • 所需参数h-shadow,v-shadow,blur,color
  • h-shadow:水平阴影的位置,即水平偏移量
  • v-shadow:垂直阴影的位置,即垂直偏移量
  • blur:模糊的距离
  • color:阴影的颜色

style_text.css

代码语言:javascript
复制
h2 {
  text-align: center;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: bold;
  font-style: italic;
}
p {
  text-align: center;
  text-decoration: underline;
  text-shadow: 2px 2px 4px black;
  color: white;
  font-style: italic;
  font-weight: bold;
}
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-02-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 小白也编程 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档