blogsmith Posted March 25, 2006 Share Posted March 25, 2006 I thought that this code <img src="photo.jpg" title="NAME"> will make a photo a clickable link which when the mouse hover over it will give a popup box that says "NAME". But it didn't work. What did I do wrong?Thanks in advance Link to comment Share on other sites More sharing options...
vchris Posted March 25, 2006 Share Posted March 25, 2006 This should be adding a pop-up that says NAME because of your title attribute. Depending on the browser you use, they don't always show it. I know with Firefox it doesn't always show it but if I right click the image, I can see the title. If it's IE then it should show on mouse over.About the image being linked, you'll want to add the <a> element on both sides of your image. As shown below: <a href="pagename.html"><img src="photo.jpg" title="NAME" border="0"></a> Make sure to add border="0" in your image element or else you'll have an ugly border around it Link to comment Share on other sites More sharing options...
calvin182 Posted March 25, 2006 Share Posted March 25, 2006 I also suggest adding a alt attribute to the img tag so it validates properly. In IE if you have an alt attribute it displays on hover, in firefox you need to use title. I always use both and here's why. Every page on my site is composed of many images, and I really don't want the word "spacer" to be visable when hovering over many areas on my site, so I use an alt attribute (alt="spacer") and a title attribute (title="") so it validates but doesnt display anything. Then if I do want something to display, I set both to the same text, so I maintain compatibility between browsers. Link to comment Share on other sites More sharing options...
Jonas Posted March 26, 2006 Share Posted March 26, 2006 I'd never use image tags for spacers though, that's a lot of unnecessary code. Use a div or something, and give it a background-image with repeat with css. Link to comment Share on other sites More sharing options...
blogsmith Posted March 26, 2006 Author Share Posted March 26, 2006 Forgot the <a> </a> tags. Added it in, it worked. Thanks to both. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now