视觉艺术js css html

CSS基础-03-文本和字体(文本颜色、文本对齐、删除线、下划线

2022-06-12  本文已影响0人  玄德公笔记

1.文本

1.1 文本颜色 (color:xxx)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>蜀</title> 
<style>
body {color:red;}
h1 {color:#00ff00;}
p.ex {color:rgb(0,0,255);}
</style>
</head>

<body>
<h1>这是标题 1</h1>
<p>这是一个普通的段落。请注意,本文是红色的。页面中定义默认的文本颜色选择器。</p>
<p class="ex">这是一个类为"ex"的段落。这个文本是蓝色的。</p>
</body>
</html>

1.2 文本对齐(text-align)

text-align:center;
text-align:right;
text-align:justify;

1.3 上/中/下划线(text-decoration)

text-decoration:overline;
text-decoration:line-through;
text-decoration:underline;
text-decoration:none

1.4 大小写转换(text-transform)

text-transform:uppercase;
text-transform:lowercase;
text-transform:capitalize;

1.5 文本缩进(text-inden)

text-indent:50px;

2. 字体

2.1 字体系列(font-family)

font-family:xxxx,"xx xx",xxxx;

说明:
可以定义几个,后边是备用
空格或汉语要加引号

2.2 字体样式(font-style)

font-style:normal;
font-style:italic;

2.3 字体大小(font-size)

font-size:40px;
font-size:2.5em;
font-size:50%;

2.4 字体加粗(font-weight)

font-weight:normal;
font-weight:lighter;
font-weight:bold;
font-weight:800;

2.5 变体和正常体(font-variant)

font-variant:small-caps;
font-variant:nomal;
上一篇 下一篇

猜你喜欢

热点阅读