sorry ladies and gents this maybe a newbie question but i googled and couldnt find an answer.... i want to optimize my alt and title tags for images, in my index.php i have something like; <div id="logo" alt="logo" Title="here is our logo"> </div>[CODE] and then in the css file i have the url for the image that relates to id="logo" when i look in the firefox with images turned off I get the title when i hover where the image should be but no alt text? am i doing something wrong? Code (markup):
sorry i dont understand make the code? <div id="logo" alt='logo' Title='here is our logo'> </div>[code] replacing " with ' for alt and title? Code (markup):
Alt is Alternative Say, the image path is broken or will not load, it will load the alernative so if i did <img src="cow.png" alt="COW!!!"/> and it cannot find the image, it will display the text "COW!!!". this is not needed in divs because they will always load. You just need this for externally loaded media such as videos images etc.
You need to use the IMG element for the alt="" attribute to work. Since you're focusing on the logo, use this markup: <div id="header"> <img src="/images/logo.png" width="200" height="80" alt="Web Site Name" title=""> </div> Code (markup): A few things: the file extension can be either a .gif .jpg or .png - the width and height values I gave are placeholders (use whatever the size of your logo is) - "Web Site Name" is just a placeholder for the name of the site - title="" is needed to fix a bug in Internet Explorer.
so basically i shouldnt bother to put the images in the css file just put the code like dan suggest above then i can include the alt and title etc. can i still leave the margin and hieght,padding etc in the css file but just delete the background url and put that in the html? thanks for your great help!!!!!!!
Oh no, if the images are not content (if they are decoration) they should be in the background with CSS! It's just that, Dan was giving an example of using alt text, which is text that must be added to any images which are in the HTML (with the <img src="..."> tag). Title is for when you need to explain something a little, usually a link (because title shows on mousehover) (you can put it on other things like an image, but it does not show unless hovered over!). Like, if you do something like this: Click here for awesome deals. You should have a title on the link which says "Find deals here at Joe's Fishing and Tackle site" or something.. tell people where they are clicking (of course, "click here" is bad form anyway, but I've had to use it myself when told to).