标签:des style blog http color os
a:link {color: #FF0000} /* 未访问的链接 */
a:visited {color: #00FF00} /* 已访问的链接 */
a:hover {color: #FF00FF} /* 鼠标移动到链接上 */
a:active {color: #0000FF} /* 选定的链接 */
以上分别定义了超链接未访问时的链接样式,已访问的链接样式,鼠标移上时链接样式和选定的链接样式。之所以称之为伪类,也就是说它不是一个真实的类,正常的类是以点开始,后边跟一个名称,而它是以a开始后边跟个冒号,再跟个状态限定字符。
链接在默认状态下是内联元素,转换为块级元素后可以获得更大的点击区域,可以设置宽度和高度,将链接转换为块状,只需增加一个display:block的css属性即可。
a { display: block; height: 30px; width: 100px; line-height: 30px; text-align: center; background: #CCC; }
a:hover { color: #FFF; text-decoration: none; background: #333; }
a { display: block; height: 34px; width: 107px; line-height: 2; text-align: center; background: url(/upload/2010-08/14/014304_btn_bg.gif) no-repeat 0px 0px; color: #d84700; font-size: 14px; font-weight: bold; text-decoration: none; padding-top: 3px; }
a:hover { background: url(/upload/2010-08/14/014304_btn_bg_hover.gif) no-repeat 0px 0px;}
p { width: 400px; line-height: 1.5; font-size: 14px; }
p:first-letter { font-family: "microsoft yahei"; font-size: 40px; float: left; padding-right: 10px; line-height: 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/html; charset=gb2312" /> <style type="text/css"> body { margin:0 auto; font-size:12px; font-family:Verdana; line-height:1.5;} ul,dl,dt,dd,h1,h2,h3,h4,h5,h6,form { padding:0; margin:0;} ul { list-style:none;} img { border:0px;} a { color:#05a; text-decoration:none;} a:hover { color:#f00;} #layout ul li { width:72px; float:left; margin:20px 0 0px 20px; text-align:center;} #layout ul li a { display:block;} #layout ul li a img { padding:0px; border:2px solid #e1e1e1; margin-bottom:3px;} #layout ul li a:hover img { padding:0px; border:2px solid #f98510;} </style> </head> <body> <div id="layout"> <ul> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> <li><a href="#"><img src="img/pic1.jpg" width="68" height="54" />三亚</a></li> </ul> </div> </body> </html>
标签:des style blog http color os
原文地址:http://www.cnblogs.com/CanWork/p/3849940.html