...

View Full Version : problems adding h1 tag to my image



LJackson
04-03-2009, 05:02 PM
Hi All,

I have added a h1 tag to my logo and added a title to it but for some reason it has dropped down a line as well.

here is my code

<div id='logo'>
<h1>
<img src='images/logo/thelogo.png'
title="Kernow Connect - For the smarter shopper"
alt="Kernow Connect - For the smarter shopper"
height='125'
width='340'
border='0' />
</h1>
</div>

does this look right?

cheers ALL
Luke

abduraooft
04-03-2009, 05:10 PM
does this look right? No. height and width are deprecated attributes.

LJackson
04-03-2009, 05:14 PM
oh ok thanks for that,

unfortunatly it hasnt fixed the problem with the image being moved down a line, it only happened since i added the h1 tags?

cheers for your time mate
Luke

abduraooft
04-03-2009, 05:16 PM
Try adding

h1{
margin:0;
padding:0
}. Could you post a link to your page?

LJackson
04-03-2009, 05:26 PM
thanks mate that worked a treat :)

just out of curiosity why does a h1 tag add margins and padding?
seems strange to me, (but then again all this web development is :D)

Luke

abduraooft
04-03-2009, 05:41 PM
All browsers apply some default styles on almost all elements. You may see a sample style sheet at http://www.w3.org/TR/CSS21/sample.html

This is why, it's considered as a best practice to add a CSS rule like

*{
margin:0;
padding:0
} in our CSS, to override all browser specific defaults of margins and paddings. After that we may add the specific values if required, to get a uniform appearance in all browsers.

Apostropartheid
04-03-2009, 06:34 PM
Abdura, height and width are not deprecated values on the img element and are there to stop the page jumping about before the client can retrieve the image data. Usage is actually recommended. The border attribute is another issue.

abduraooft
04-03-2009, 06:43 PM
Yeah, I know. I wasn't specific there :) Thanks for correcting me.

sea4me
04-03-2009, 11:44 PM
Yeah, I know. I wasn't specific there :)

Or did you....... :confused:


lol


jk jk jk



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum