文本颜色和效果——text-decoration

一、文本颜色

  • 定义颜色方式 :1、颜色名称   2、RGB值(eg:#CC66FF       #C6F       rgb(204, 102, 255)        rgb(80%, 40%, 100%))   #FFFFFF:白色
  • 特殊文本效果:只对包含文本的css元素有用,对其他对象没有效果。

        1、text-decoration属性:(大多数浏览器为超文本链接自动使用text-decoration:underline)

text-decoration属性的值
效果
blink 文本闪烁开和关 (最好不要使用)
line-through文本中间画一条线(删除线)
overline在文本顶端之上画一条线(上划线)
underline在文本顶端之下画一条线(下划线)
none无效果(常用来关闭下划线)
inherit使用包含盒子的text-decoration的值
             text-decoration的颜色(删除线、上划线或下划线)和文本本身的颜色一致,因此可以通过color属性设置,线的粗细、厚度由浏览器决定。

例子: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;}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值