送男朋友礼物最有意义:<a href="index.jsp" class="atop">后面的class是什么意思

来源:百度文库 编辑:查人人中国名人网 时间:2024/03/28 16:45:11

class 是类,用来定义 style 属性。
在使用 CSS(样式表)时用 class 可以更方便。
举例:
文件1:C1.CSS
.Bar
{
border-right: 2px outset;
border-top: 2px outset;
overflow: auto;
border-left: 2px outset;
border-bottom: 2px outset;
}
.BCap
{
color: graytext;
}

.BDroper
{
border-right: 2px outset;
border-top: 2px outset;
border-left: 2px outset;
width: 1px;
cursor: move;
border-bottom: 2px outset;
position: static;
height: 100%;
}

这个文件定义了三个类(class):
Bar 工具栏的样式
BCap 工具栏标题的样式
BDroper 工具栏拖动按钮的样式

文件2:Main.HTM (HTML)
<HTML>
<HEAD>
<LINK href="C1.CSS" type=text/css rel=stylesheet> <!--样式表的路径-->
</HEAD>
<BODY>
<DIV class="Bar">
<a class="BDroper"></a>
<a class="BDroper"></a>
  
<a class="BCap">浏览</a>
<a href="javascript:history.back(1)">返回</a>
<a href="javascript:history.forward(1)">前进</a>
</DIV>
<BODY>
</HTML>

如果不是用样式表,文件2的内容如下:
<HTML>
<HEAD>
<!--没有样式表-->
</HEAD>
<BODY>
<DIV style="border-right: 2px outset; border-top: 2px outset; overflow: auto; border-left: 2px outset; border-bottom: 2px outset;">
<a style="border-right: 2px outset; border-top: 2px outset; border-left: 2px outset; width: 1px; cursor: move; border-bottom: 2px outset; position: static; height: 100%;"></a>
<a style="border-right: 2px outset; border-top: 2px outset; border-left: 2px outset; width: 1px; cursor: move; border-bottom: 2px outset; position: static; height: 100%;"></a>
  
<a style="color: graytext;">浏览</a>
<a href="javascript:history.back(1)">返回</a>
<a href="javascript:history.forward(1)">前进</a>
</DIV>
<BODY>
</HTML>

可见,如果使用样式表以及 class 属性,则对于样式的定义就能简单的多。
<a href="index.jsp" class="atop">
这定义了一个超链接,它的类为 atop。如果你能找到这个网页的样式表,你会找到这个类的定义。也许是这样的:
.atop
{
.....
}

当然,一个网页也可以使用多个样式表:
...
<HEAD>
<LINK href="C1.CSS" type=text/css rel=stylesheet> <!--样式表1的路径-->
<LINK href="..\C2.CSS" type=text/css rel=stylesheet> <!--样式表2的路径-->
<LINK href="DD1\S1\Main.CSS" type=text/css rel=stylesheet> <!--样式表3的路径-->
</HEAD>
...

这个意思你“类”,这个连接用了CSS样式

是样式类,可以在.css里定义.