字體變成紅色失敗,變?yōu)閴K級元素也失敗。哪里的問題怎么改都不對?
<!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/html; charset=gb2312" />
<title>3.1頁面頭部制作練習題</title>
<style type="text/css">
body{
? ? margin:0;
? ? background-color:grey;
}
.h3{
? ? float:left;
? ? width:80px;
} ? ?
.top li{
? ? display:block;
? ? float:right;
? ? width:70px;
? ? line-height:50px;
? ? margin:0 auto;
}
.top a:link{
? ? color:red;
? ? text-decoration:none;
}
.top a:hover{
? ? color:blue;
? ? text-decoration:none;
}
? ? /*在此定義相關(guān)樣式,控制列表的顯示形式*/
</style>
</head>
<body>
<h3>課程難度</h3>
<div class="top">
<ul>
? ? <li><a href="#">高級</a></li>
? ? <li><a href="#">中級</a></li>
? ? <li><a href="#">初級</a></li>
? ? <li><a href="#">全部</a></li>
</ul>
? ? </div>
</div> ? ?
</body>
</html>
2020-03-23
你的top-li沒有設(shè)置高度,display沒有起作用,可以連起來寫
.top li,.top a:hover,.top a:active{
width:50px;
heitht:30px;
display:block;
background-color:red;
float:left;
}
2020-03-12
題目沒說讓字體變紅吧,是背景變紅。
就算你想讓字體變紅,a:link和a:visited 也要同時設(shè)置才行,
.top a:link,.top a:visited{
}
2019-11-30