css设置首行缩进,文字字母距离

 2022-03-13    584  

在77ISP学技术

每日笔记,文字的首行缩进。文字字母距离

css设置首行缩进,文字字母距离

文字缩进

text-indent 属性用于指定文本第一行的缩进:


实例

p {
  text-indent: 25px;
}

我的文本14px的写一段话首行缩进2格就是25px了,我们来测试一下,这个css的属性

看一是不是首行缩进2格

字母间距

letter-spacing 属性用于指定文本中字符之间的间距。


下例演示如何增加或减少字符之间的间距:

实例

p {
  letter-spacing: 3px;
}

p {
  letter-spacing: -2px;
}

This is heading 1

This is heading 2

行高

line-height 属性用于指定行之间的间距:


实例

p.small {
  line-height: 0.8;
}

p.big {
  line-height: 1.8;
}

这是行高更小的段落。
这是行高更小的段落。

这是行高更大的段落。
这是行高更大的段落。

字间距

word-spacing 属性用于指定文本中单词之间的间距。

下例演示如何增加或减少单词之间的间距:

p {
  word-spacing: 10px;
}

p {
  word-spacing: -5px;
}

This is heading 1

This is heading 2

空白

white-space 属性指定元素内部空白的处理方式。


此例演示如何禁用元素内的文本换行:


实例

p {
  white-space: nowrap;
}


我加了空白 This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.


我没加空白 This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.

  •  标签:  
  • css
  •  

原文链接:https://77isp.com/post/393.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。