2010-12-14 64 views
0

我期待把超鏈接放在不同的地方。如何將google.com鏈接移至頁面上的其他位置?我想要超鏈接在不同的地方

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
     "http://www.w3.org/TR/html4/loose.dtd"> 

<html> 
<head> 
<title>Randy's first html web page !</title> 
<style type="text/css"> 
body 
{background-image:url('Koala.gif');} 
h1 
{ 
text-align:center; 
font-size:500%; 
} 
h2 
{ 
text-align:center; 
font-size:250%; 
} 
p 
{ 
text-align:center; 
font-size:200%; 
color:#00fff0; 
} 
div 
{ 
background-color:#efffff; 
} 
a 
{ 
text-align:center; 
} 
th 
{ 
background-color:green; 
} 
tr 
{ 
background-color:green; 
} 
table 
{ 
width: 200px; 
margin-left: auto; 
margin-right: auto; 
} 
</style> 
</head> 
<h1> Hello Professor</h1> 
<h2> By: Randy White</h2> 
<P> It's getting better as the term goes on.</P> 
<P>Week 2</P> 
<P><img src="Hydrangeas.jpg" width="150" height="100" alt="Hydrangeas.jpg"></P> 
<table border="1"> 
<tr> 
<th>Month</th> 
<th>Day</th> 
<th>Year</th> 
</tr> 
<tr> 
<td>December</td> 
<td>13</td> 
<td>2010</td> 
</tr> 
</table> 
<a href="http://www.google.com">Visit Google!</a> 
</body> 
</html> 
+1

簡而言之:CTRL-X,CTRL-V – miku 2010-12-14 01:31:56

+0

不是開玩笑我是新來的CSS,我越來越好,但我仍然有一些問題 – user770022 2010-12-14 01:33:11

+0

通過在文檔中剪切/粘貼到其它地方? – David 2010-12-14 01:33:29

回答

0

在你的CSS,補充一點:

#google-link { 
    text-align: center; 
} 

這在中心內部對齊文本。

在HTML中,更改谷歌連結此:

<div id="google-link"><a href="http://www.google.com">Visit Google!</a></div> 

DIV的被打上了谷歌一鏈接ID,它得到它上面的樣式。樣式實際上會影響div的內容,將它們對齊到中心。 div本身就是頁面的寬度。

+0

多數民衆贊成在它得到它 – user770022 2010-12-14 01:43:09

+1

@randy:你很幸運,任何工作。你錯過了一個開場標籤 – Gerrat 2010-12-14 01:54:41

+0

你看看那個,他是。良好的捕獲,@Gerrat - 我完全掩飾了這一點。 – 2010-12-14 01:56:10

0
body { 
    margin: auto; 
} 
0
  1. 您的html缺少開放< body>標籤!
  2. add「text-align:center;」到您的CSS身體標記。
相關問題