【CSS3】文本属性

时间:2023-03-09 04:23:59
【CSS3】文本属性
 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<p id="p1">text-align文本水平对齐方式</p>
<p>This is a test sentence. 汉字 之间 无 空格 会 当作 一个 单词。 </p>
<p id="p3">abcdqwert yuiopasdfg hjklzxcvbn mnqwertyuioqwe rtyuiasdf ghjzxcvb qwetyuasdfg hzxcv bnasdfgh qwerty uwertyusdfghxcvb qwertyusdfghxcvbnoqwertyuioasdfghjklzxcvbnm</p>
<p id="p4">abcdqwert yuiopa sdfghjklzx cvbnmnqwe rtyuioqwerty uiasdfghjzxcvb qwetyuas dfghzxcvbnasdfg hqwertyuwe rtyusd fghxcvbqwertyusdfghxcvbnoqwerty uioasdfghjklzxcvbnm</p>
<p id="p5">abcdqwert yuiopa sdfghjklzx cvbnmnqwe rtyuioqwerty uiasdfghjzxcvb qwetyuas dfghzxcvbnasdfg hqwertyuwe rtyusd fghxcvbqwertyusdfghxcvbnoqwerty uioasdfghjklzxcvbnm</p>
<h1>h1标签内容</h1>
</body>
</body>
</html>
 /*#p1{*/
/*text-align: justify;*//*默认left,可设right、center、justify、start、end*/
/*line-height: 3;*//*设置行高:normal、数字、百分比、px、em*/
/*text-indent: 20px;*//*设置首行缩进:像素、百分比、em*/
/*text-decoration:line-through overline underline;*//*默认值none在超链接去掉默认下划线时可用到,下划线underline,上划线overline,删除线line-through,闪烁文本blink*/
/*letter-spacing: 2em;*//*设置字符间距,默认normal,可用像素、em,可设负值*/
/*}*/
p{
/*word-spacing: 2em;*//*类似letter-spacing,可设负值*/
/*text-transform: lowercase;*//*none默认;capitalize每个单词以大写字母开头,uppercase转换为大写字母,lowercase转换为小写字母*/
/*text-shadow: 3px 3px 3px red, -6px -6px 3px green;*//*四个参数:横向偏移、纵向偏移、模糊度、颜色,可加多个阴影用逗号隔开*/
/*white-space: pre;*//*设置元素中空白处理方式:默认normal;pre空白会保留,类似pre标签;nowrap文本不会换行,文本会在同一行上继续,直到遇到br标签为止;pre-wrap保留空白正常换行;pre-line合并空白正常换行*/
/*direction: rtl;*//*默认ltr*/
/*unicode-bidi: bidi-override;*//*从右向左读文字,一般配合direction使用,默认normal,可设embed*/
}
#p3{
background: green;
width: 200px;
word-wrap: break-word;
}
#p4{
background: blue;
width: 200px;
word-wrap: ;
}
#p5{
background: red;
width: 200px;
word-break: break-all;/*比work-wrap的break-word拆的更彻底。keep-all只能在半角空格或连字符处换行*/
}
h1{
-webkit-text-stroke:1px red;/*多数浏览器不支持此功能,所以要加浏览器私有前缀-webkit-*/
-webkit-text-fill-color:blue;
}
/*text-overflow设置是否使用一个省略标记...标示对象内文本溢出:clip默认值,当对象内文本溢出时不显示省略标记,而是将溢出部分裁掉;ellipsis当对象内文本溢出时显示省略号。此属性要和over-flow:hidden属性,white-space:nowrap配合使用。*/
/*
text-outline规定文本的轮廓;
text-justify规定当text-align设置为justify时所使用的对齐方式;
text-align-last设置如何对齐最后一行或紧挨强制换行符之前的行;
text-emphasis向元素的文本应用重点标记以及重点标记的前景色;
hanging-punctuation规定标点字符是否位于线框之外;
punctuation-trim规定是否对标点字符进行修剪;
tab-size设定一个tab在页面中的显示长度;
text-wrap规定文本的换行规则。
*/