在 CSS3 中,可以通过字体相关属性和文本相关属性来改变文字样式。下面按常见需求分类说明:
p {
font-family: "Microsoft YaHei", Arial, sans-serif;
}
p {
font-size: 16px;
}
p {
font-weight: bold; /* normal | bold | 100~900 */
}
p {
font-style: italic; /* normal | italic | oblique */
}
p {
font-variant: small-caps;
}
p {
color: #333;
}
p {
background-color: #f5f5f5;
}
p {
text-align: center; /* left | right | justify */
}
p {
line-height: 1.6;
}
p {
letter-spacing: 2px;
}
p {
word-spacing: 5px;
}
p {
text-indent: 2em;
}
a {
text-decoration: none; /* underline | line-through | overline */
}
p {
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@font-face {
font-family: "MyFont";
src: url("myfont.woff2");
}
p {
font-family: "MyFont";
}
p {
background: linear-gradient(red, blue);
-webkit-background-clip: text;
color: transparent;
}
.text {
font-family: Arial;
font-size: 18px;
font-weight: bold;
color: #ff5722;
text-shadow: 1px 1px 2px #000;
}
如果你有具体想实现的效果(比如“发光文字”“竖排文字”“艺术字”),可以直接告诉我。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。