Solved

vvveasy center image

Posted on 2003-11-28
4
282 Views
Last Modified: 2012-08-14
i'm a very bloody n%b in this,
I just want to center an image horizontal & vertical acording to the window size
nothing else is on the page
0
Comment
Question by:dkloeck
  • 2
4 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9838464
If it's the only thing on the page, then use the CSS background property:

<html>
<head>
<style type="text/css">
<!--
body {background-image: url(myimage.gif); background-position:center center; background-repeat:no-repeat; }
//-->
</style>
</head>
<body>
</body>
</html>
0
 
LVL 10

Author Comment

by:dkloeck
ID: 9838524
but the image is a link to another page, isn't there another way?
0
 
LVL 31

Accepted Solution

by:
seanpowell earned 20 total points
ID: 9838576
Absolutely:

<html>
<head>
<title></title>
<style type="text/css">
<!--
div#myimage {
position: absolute;
top: 50%;
left: 50%;
margin-top: -40px;
margin-left: -100px;
}
//-->
</style>
</head>
<body>
<div id="myimage">
<A href="index.html"><img src="image.gif" width="200" height="80"></a>
</div>
</body>
</html>

The negative margins are 1/2 the width and height of the image.
0
 

Expert Comment

by:Kane00
ID: 9840922
You can use this code. It is simply a table!

<html>

<head>
<title>Example</title>
</head>

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">

<table border="0" cellpadding="0" style="border-collapse: collapse" width="100%" height="100%">
      <tr>
            <td style="text-align: center">
            Place your image here, with the links and everything.
            </td>
      </tr>
</table>

</body>

</html>
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now