文本颜色和效果——text-decoration
2014-08-26 16:51
246 查看
一、文本颜色
定义颜色方式 :1、颜色名称 2、RGB值(eg:#CC66FF #C6F rgb(204, 102, 255) rgb(80%, 40%, 100%)) #FFFFFF:白色特殊文本效果:只对包含文本的css元素有用,对其他对象没有效果。
1、text-decoration属性:(大多数浏览器为超文本链接自动使用text-decoration:underline)
值 | 效果 |
---|---|
blink | 文本闪烁开和关 (最好不要使用) |
line-through | 文本中间画一条线(删除线) |
overline | 在文本顶端之上画一条线(上划线) |
underline | 在文本顶端之下画一条线(下划线) |
none | 无效果(常用来关闭下划线) |
inherit | 使用包含盒子的text-decoration的值 |
例子:HTML页面代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 特殊文本处理 </TITLE>
<link rel="stylesheet" type="text/css" href="10-1.css">
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<table class="nav" border="0" align="right">
<tr><th><a href="2-7.html">HOME</a></th></tr>
<tr><th><a href="2-8.html">INFO</a></th></tr>
<tr><th><a href="2-9.html">HELP</a></th></tr>
<tr><th><a href="2-7.html">NEWs</a></th></tr>
</table>
<h1>I <em>love</em> to decorate!</h1>
<p>I think that decorationg <span class="oops">cakes</span>HTML is lots of fun. Here are some of my favorites:</p>
<div class="eg">
<p id="a" style="background-color:red">Underlined text (don't you want to click here?)</p>
<p id="b">Line-through text</p>
<p id="c">Overlined text</p>
<p id="d">Blinking text (this is hard to show in print!)</p>
</div>
</body>
</HTML>
css代码
body {
font-family:Verdana, sans-serif;}
.nav {
border:0.3em solid black;}
.nav a:link, .nav a:visited
{
text-decoration:none;}
h1 em {
text-decoration:underline;}
.oops {
text-decoration:line-through;}
.eg {
border:1px solid black;
margin:2em;
padding:1em;}
#a {
text-decoration:underline;}
#b {
text-decoration:line-through;}
#c {
text-decoration:overline;}
#d {
text-decoration:blink;}
相关文章推荐
- TextView中的文本加效果,如设置不同颜色,大小或点击事件
- HTML基础 body标签text属性将普通文本颜色改为白色,实现有趣的密文效果
- Unity Text文本颜色渐变效果
- CSS的定位属性实现text-shadow属性的文本下产生阴影效果
- 给TextView加上多彩效果:改变部分字体的大小和颜色
- Android TextView多文本折叠展开效果
- Android简易实战教程--第十九话《手把手教您监听EditText文本变化,实现抖动和震动的效果》
- TextView显示(不同大小的,颜色)富文本
- Android buttom textview 颜色平滑过渡的动画效果
- 37-TextView设置文本颜色显示
- 给TextView加上多彩效果:改变部分字体的大小和颜色
- android:TextView中的文本链接之--设置超链接、颜色、字体等属性
- 如何在一个TextView中显示不同颜色的文本
- android textview 文本显示不同颜色
- android textview 文本在代码中设置粗体效果
- (转)TextView 设置背景和文本颜色的问题
- Android简易实战教程--第十九话《手把手教您监听EditText文本变化,实现抖动和震动的效果》
- textView文本不同颜色
- text-decoration 属性对文本进行修饰。
- 对现有的控件进行拓展,以TextView为例,为文本加彩虹渐变效果