Click to See Complete Forum and Search --> : hi how to align an image in the header


msg2ajay
10-31-2007, 03:37 AM
hello friends,
I am trying to put an image in the HEADER of the page. But i am getting slight empty space(white space) around the image nearly a letter gap in left,top. Is there any way to align the image to left and top most corner of the page. my code is ...



<body leftmargin="0" topmargin="0">
<table cellspacing="0" cellpadding="0" marginwidth="0" marginheight="0" border="0" width="100%" >
<tr>
<td width="100%" height="50" valign="middle" background="">
<img src="/images/header.png" width="100%" height="50">
</td>
</tr>
</table>
</body>


thx in adv,
Ajay

NogDog
10-31-2007, 03:53 AM
<img src="/images/header.png" width="100%" height="50" style="display:block">

msg2ajay
10-31-2007, 04:02 AM
thankQ for reply,
i have added the style which you have given but the same problem repeating. any other ideas....i will be greatful to u.

thx

Major Payne
11-01-2007, 02:15 AM
Going to be a little difficult to do the position you want using tables as it never gets snugged up in some browsers even with all the padding/margin at zero.

Try:
<head>
<style type="text/css">
* { border: 0; padding: 0; margin: 0; }

#header {
background-color: #XXXXXX; // Your preferred color
background-image: url(/images/header.png); background-repeat: no-repeat; background-position: top left; }
width: XXpx // Actual width in pixels
height: 50px;
</style>

<body>
<div id="header"></div>
</body>


Could try to position image absolutely if you stick with tables. If you use a separate CSS, just transfer style to it. The universal selector (* ... ) stuff goes at very top of CSS. I used the long method, but you can shorten the code if needed.

Hope that works for you.

Ron