css文本行高是哪个属性_字间距、词间距的使用CSS入门基础(010)


今天我们接着分享文本样式的内容。letter-spacing字母间距:在css中,我们可以使用letter-spacing属性定义字间距。语法:
letter-spacing:像素值;
我们一般都是使用像素值为单位的。示例代码:
<html>  <head>    <title>letter-spacingtitle>    <style type="text/css">      #p1 { letter-spacing:0px;}      #p2 { letter-spacing:5px;}      #p3 { letter-spacing:10px;}    style>  head>  <body>    <p id="p1">I like Coding.我喜欢编程。p>    <p id="p2">I like Coding.我喜欢编程。p>    <p id="p3">I like Coding.我喜欢编程。p>  body>html>
letter-spacing控制的是字间距,每一个中文文字算作一个“字”,而每一个英文字母也算作一个“字”,这个需要大家留心记住。word-spacing属性:用于定义单词之间的距离,我们通常使用像素值作为单位。语法:
word-spacing:像素值;
示例代码:
<html>  <head>    <title>word-spacingtitle>    <style type="text/css">      #p1 { word-spacing:0px;}      #p2 { word-spacing:10px;}      #p3 { word-spacing:20px;}style>  head>  <body>    <p id="p1">I like Coding.我 喜欢编程。p>    <p id="p2">I like Coding.我 喜欢编程。p>    <p id="p3">I like Coding.我 喜欢编程。p>  body>html>
定义词间距,以空格为基准进行调节。如果多个单词被连在一起,则被视为一个单词;如果汉字被空格分隔,此时word-spacing属性有效。
文本样式的总结:text-decoration,下划线、删除线、顶划线text-transform,文本变形,大小写font-variant,英文文本变为小型的大写字母text-indent,段落文本缩进text-align,文本水平对齐方式line-height,行高letter-spacing,字距word-spacing,词距text-decoration属性值:none,underline,line-through,overline。text-transform属性值:none,uppercase,lowercase,capitalize。font-variant属性值:normal,small-caps。text-indent属性值:像素值;text-align属性值:left,center,right。line-height属性值:像素值;letter-spacing属性值:像素值;word-spacing属性值:像素值;

2e488e17719c526bac65f48c2f11250c.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值