链接目标指向本页;
View Code
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"lang="en" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
5 <title>v_v</title>
6 <style type="text/css">
7 a:visited {color:silver; }
8 a:link {color:lime; }/*它们俩的顺序不重要,但是最好还是依据标准的LVFHA序列更好*/
9 div {width:400px; height:900px; border:1px dashed maroon; }
10 </style>
11 </head>
12
13 <body>
14 <a href="#destination">Click now!</a>
15 <a href="#aim">strick it!</a>
16 <div></div>
17 <p id="aim">paragraph</p><!--目标位置,只能用id 标注才能生效-->
18 <div></div>
19 <a name="destination">here it is!<a><!--目标锚,用name或者id 标注都可以-->
20 </body>
21 </html>
:link:hover与:visited:hover;
View Code
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"lang="en" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <title>~!~</title>
6 <style type="text/css">
7 body {font-size:20px; }
8 a:link, a:visited {color:silver; text-decoration:none; }
9 a:visited {color:purple; }
10 a:link:hover {background:red; }
11 a:visited:hover {background:green; }
12 </style>
13 </head>
14
15 <body>
16 <a href="#aim">link</a>
17 <a name="aim">aim</a>
18 </body>
19 </html>
哪来的缝隙?
View Code
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"lang="en" xml:lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5 <title>~!~</title>
6 <style type="text/css">
7 div {border:2px solid silver; }
8 a {text-decoration:none; }
9 a.inline_link {border:5px solid olive; }
10 a.block_link {border:5px solid orange; display:block; width:100px; float:left; }
11 </style>
12 </head>
13
14 <body>
15 <div>luna</div>
16 <div>lucy</div>
17 <a class="inline_link" href="#">Rona</a>
18 <a class="inline_link" href="#">Rose</a>
19 <p>上面普通链接的边框覆盖到了其它元素的区域,并且它们之间有间距,Firebug未显示它们有margin,那么它们的边距是哪来的?需要注意到的是:它们之间的缝隙宽度与它们的边框宽度无关!若是block之后就不会有间距了;</p>
20 <a href="" class="block_link">Yamaha</a>
21 <a href="" class="block_link">Yanubeca</a>
22 </body>
23 </html>

浙公网安备 33010602011771号