CSS text attributes (Text)
Attributes | description | CSS |
---|---|---|
color | Set the color of the text. | 1 |
direction | Specifies the direction/writing direction of the text. | 2 |
letter-spacing | Set the character spacing. | 1 |
line-height | Set the row height. | 1 |
text-align | Specifies the horizontal alignment of the text. | 1 |
text-decoration | Specifies the decorative effect added to the text. | 1 |
text-indent | Specifies the indentation of the first line of a text block. | 1 |
text-shadow | Specifies the shadow effect added to the text. | 2 |
text-transform | Control the case of text. | 1 |
unicode-bidi | Set the text direction. | 2 |
white-space | Specifies how to deal with whitespace in elements. | 1 |
word-spacing | Set the word spacing. | 1 |
hanging-punctuation | Specifies whether the punctuation characters are outside the line frame. | 3 |
punctuation-trim | Specifies whether to trim punctuation characters. | 3 |
text-align-last | Set how to align the last line or the line immediately before the forced line break. | 3 |
text-emphasis | Apply the emphasis mark and the foreground color of the emphasis mark to the text of the element. | 3 |
text-justify | Specifies the alignment method used when text-align is set to "justify". | 3 |
text-outline | Specifies the outline of the text. | 3 |
text-overflow | Specifies what happens when the text overflows the containing element. | 3 |
text-shadow | Add a shadow to the text. | 3 |
text-wrap | Specifies the wrapping rules of the text. | 3 |
word-break | Specify line break rules for non-Chinese, Japanese, and Korean texts. | 3 |
word-wrap | Allows long indivisible words to be split and wrap to the next line. | 3 |
Text decoration attribute (text-decoration attribute)
Format: text-decoration: underline;
Possible value
value | description |
---|---|
none | default. Define standard text. |
underline | Define a line under the text. |
overline | Define a line on the text. |
line-through | Define a line that passes under the text. |
blink | Define the flashing text. |
inherit | Specifies that the value of the text-decoration attribute should be inherited from the parent element. |
The value of the none attribute is useful. Our default link has an underscore. If we don't want it, we can set the a tag to none.
a{
text-decoration: none;
}
快捷键就是单词首字母+table键
文本水平对齐属性(text-align 属性)
格式:text-align:center;
可能的值
值 | 描述 |
---|---|
left | 把文本排列到左边。默认值:由浏览器决定。 |
right | 把文本排列到右边。 |
center | 把文本排列到中间。 |
justify | 实现两端对齐文本效果。 |
inherit | 规定应该从父元素继承 text-align 属性的值。 |
ta +table键默认 text-align:left;
文本缩进属性(text-indent 属性)
规定文本块中首行文本的缩进。
格式: text-indent:50px;
可能值
2em: 缩进两个文字的宽度
2cm: 缩进两厘米的距离
2px: 缩进两个像素
20%: 缩进20%的宽度
快捷键 ti+table
字母间隔属性(letter-spacing 属性)
格式: 增加或减少字符间的空白(字符间距)。
letter-spacing:2px
字符转换属性(text-transform 属性)
控制文本的大小写。格式:
h1 {
text-transform:uppercase}
h2 {
text-transform:capitalize}
p {
text-transform:lowercase}
可能的值
值 | 描述 |
---|---|
none | 默认。定义带有小写字母和大写字母的标准的文本。 |
capitalize | 文本中的每个单词以大写字母开头。 |
uppercase | 定义仅有大写字母。 |
lowercase | 定义无大写字母,仅有小写字母。 |
inherit | 规定应该从父元素继承 text-transform 属性的值。 |