標籤:center 超連結 底線 圖片
今天是學習php的第四天。由於花了一天的時間來裝一個系統,而我對這個也並不是很瞭解,所以就不再贅述。只學習了如何設定連結。
首先是幾個定義。.表示當前所在目錄,src圖片地址。載入超連結 <a href=...>。text-decoration意為連結裝飾,用於去除底線。
下面是代碼。我用昨天的導航條為基礎,給每個標題都設定了連結。代碼如下。
<html>
<head>
<title></title>
<style>
div{height: 50px;width: 100%;background-color: blue;
}
li{
float: left;list-style: none;margin: 2px;height: 50px;line-height: 50px;
text-align: center;
}
ul{background-color: blue;
margin: 0 auto;text-align: center;height: 50px;width: 800px;
}
li:hover{
background-color: green;
}
a{text-decoration: none ;color: black;
}
</style>
</head>
<body>
<div>
<ul>
<li><a target="_blank"href="http://www.baidu.com" >滾動</a></li>
<li><a target="_blank"href="http://www.huya.com" >直播</a></li>
<li><a target="_blank"href="http://tv.cctv.com" >調查</a></li>
<li><a target="_blank"href="http://y.qq.com" >排行</a></li>
<li><a target="_blank"href="http://www.sina.com" >國際</a></li>
</ul>
</div>
</body>
</html>
還有如果想在跳轉網頁的時候想看到別的位置而不是頂部,可以給要跳轉到的網頁設定一個錨點,將連結給到錨點上。我用了轉行來將一行字推到了底部。代碼如下
<html>
<head>
<title></title>
<style type="text/css">
a{text-decoration: none ;
}
</style>
</head>
<body>
<a target="_blank" href="mc.html#b">2</a>
</body>
</html>
這是第一頁的代碼,下面是跳轉頁的。
<html>
<head>
<title></title>
</head>
<body>
<h2>小偉說自己carrry<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></h2>
<h3 id="b">小偉在底部</h3>
</body>
</html>
由於各種原因,今天唯寫這一點東西 。明天繼續!
學習php的第四天