怎么在css中对同一个标签设置不同的样式

html-css012

怎么在css中对同一个标签设置不同的样式,第1张

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<title>A标签</title>

<style type="text/css">

*{ margin:0padding:0}

a{ color:#00Ctext-decoration:nonepadding:0 20px}/*整个页面A标签的属性*/

a:hover{ color:#F00text-decoration:underline}/*整个页面A标签鼠标滑过属性*/

.one,.two{ width:800pxmargin:20px autoline-height:36pxborder:1px solid green}

.two a{ color:#000}/*在.two这个div里面A标签的属性*/

.two a:hover{ color:#0F0}

</style>

</head>

<body>

<div class="one"><a href="#">百度</a><a href="#">新浪</a><a href="#">腾讯</a><a href="#">网易</a></div>

<div class="two"><a href="#">百度</a><a href="#">新浪</a><a href="#">腾讯</a><a href="#">网易</a></div>

</body>

</html>

你可以在这个

<div class="div" style="width:50px"></div>

里面多定义一个div名称

如<div="abc" class="div" style="width:50px"></div>

你再加多一个div的style就可以了。