Solved

vvveasy center image

Posted on 2003-11-28
4
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

627 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