user770022
user770022

Reputation: 2959

I want the hyperlink to be in a different place

I am looking to put the hyperlink in a different place. How can I move the google.com link to another place on the page?

<!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>

Upvotes: 0

Views: 95

Answers (4)

Gerrat
Gerrat

Reputation: 29690

  1. Your html is missing an opening < body> tag!
  2. add "text-align:center;" to your css for the body tag.

Upvotes: 0

Surreal Dreams
Surreal Dreams

Reputation: 26380

In your CSS, add this:

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

This aligns text inside in the center.

In your HTML, change the Google link to this:

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

The div is tagged with the google-link id, which gets it the above style. The style actually affects the contents of the div, aligning them to the center. The div itself is the width of the page.

Upvotes: 0

Laurence Gonsalves
Laurence Gonsalves

Reputation: 143124

body {
  margin: auto;
}

Upvotes: 0

Alexandre
Alexandre

Reputation: 1026

I think you are interested about css positioning. Take a look at this: http://www.barelyfitz.com/screencast/html-training/css/positioning/

Upvotes: 2

Related Questions