HTML中的css除了body之外,其他在网页中都不显示。但是在dreamweaver中却全部显示。

html-css014

HTML中的css除了body之外,其他在网页中都不显示。但是在dreamweaver中却全部显示。,第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=utf-8" />

<title>无标题文档</title>

<style type="text/css">

a{text-decoration:none}

.container{width:760pxmargin:0 autobackground:#FC6}

.header{width:760pxheight:100pxbackground:url(head1.jpg) 0 0 no-repeat}

.header ul{width:600pxheight:35pxmargin:65px auto 0 60px}

.header ul li{float:leftwidth:100pxheight:35pxline-height:35pxtext-align:center}

.content{width:760pxmargin-top:35px}

.content div{border:1px solid #333}

.content_left{width:388pxheight:300pxfloat:leftmargin-right:10pxbackground:#CCC}

.content_rt{width:348pxheight:200pxfloat:leftbackground:#900}

.content_rb{width:348pxheight:70pxmargin-top:30pxfloat:leftbackground:#039}

/*---------*/

.nva_a{background:#06F}

.nva_b{background:#06C}

.nva_c{background:#0C0}

.nva_d{background:#07F}

.nva_e{background:#3F0}

</style>

</head>

<body>

<div class="container">

<div class="header">

<ul>

<li class="nva_a"><a href="#">栏目导航</a></li>

<li class="nva_b"><a href="#">栏目导航</a></li>

<li class="nva_c"><a href="#">栏目导航</a></li>

<li class="nva_d"><a href="#">栏目导航</a></li>

<li class="nva_e"><a href="#">栏目导航</a></li>

</ul>

</div>

<div class="content">

<div class="content_left"></div>

<div class="content_rt"></div>

<div class="content_rb"></div>

</div>

</div>

</body>

</html>

这是代码默认的效果

伪类选择器可以修改

<style>

a:link {color: #FF0000} /* 未访问的链接 */

a:visited {color: #00FF00} /* 已访问的链接 */

a:hover {color: #FF00FF} /* 鼠标移动到链接上 */

a:active {color: #0000FF} /* 选定的链接 */

</style>