You are here: html css » removing the border from an image within a link
Removing the border from an image within a link
- Written By
- PHPin24
- Submitted At
- 2009-08-06 22:10:08
- Num Views
- 691
- Category
- HTML / CSS
|
If you have ever had an image inside a link you will find that it creates a border (generally blue) around the image. To solve this there's two solutions. One is to use the type="image" the other is to use CSS to remove the border Solution 1: This will actually submit the form to a page and will work on all browsers. It acts like a submit button but you can have your image link to whatever you want in the form action. <form action="page1.html"> <input type="image" src="image1.gif" /> </form> Solution 2: This is the best solution to just remove the border and will work on all browsers. This allows you to open your link in a new window aswell with the target="_blank" section although is not required. You should always specify a width and height as this allows your page to load faster as the browser knows how much space to leave for the image, while if you leave the size out the browser first needs to load the image and can then continue with the code as it will only know how much space to leave once the image is loaded. You also don't need to specify the pixels, the px attribute, as images can only be specified in pixels. <a target="_blank" href="page1.html"> <img style="border:none" width="200" height="200" src="image1.gif" /> </a> By PHPin24 @ 2009-08-06 22:10:08
|
