Hi everyone

I can't remember how to get rid of the border on images when i use them as links, and also can someone remind me the code for changing text links, sumthin link <body alink="" vlink="">

But i can't remember it very well.

Recommended Answers

All 7 Replies

To get rid of borders around link images add border="0" to the image.


The preferred method for changing link colours is using stylesheets. You'd use something like

a:link{text-decoration:none;color:#3366cc;font-weight:bold;}
a:visited{text-decoration:none;color:#6699ff;font-weight:bold;}
a:active{text-decoration:none;color:#3366cc;font-weight:bold;background-color:#cccc00;}
a:hover{text-decoration:none;color:#0000cc;font-weight:bold;background-color:#cccc00;}

You can use link, alink, and vlink on the body tag and it will still work in current browsers but the body tag option doesn't allow you to set the hover colour.

As felgall said, the preferred method of doing colours is via CSS (Cascading Style Sheets). You can also take the border off images via CSS also. Here is an example. My comments are marked out by /* & */.

a:link, a:visited { /* this defines unclicked, and clicked link properties */
	text-decoration: none; /* you can set this to underline, or none. */
	color: #000000; /* sets color, hexadecimal, right now it is black */
	font-weight: bold; /* sets your font to bold. bold or none are most common here */
}
a:hover, a:active { /* defines mouseover, and clicked/processing links */
	text-decoration: underline; /* set this to the opposite of what rested state links are for it to underline on mouseover */
	color: #000000;
	font-weight: bold;
}
img { /* defines the css for the <img> tag */
	border: 0px; /* set border width to 0 pixels */
}

Ok thanks, i sort of understand but have never used css before, the image is the only one on the page and there isn't very many links, so if css does what i think it does, i don't think its nessasary here.

Just to be clear, i don't want to get rid of the border around an image, i have allready done that, its when i set the image to a link that the border comes up

You probley have answerd my question but i just don't understand css.

hey no coding is necessary, you can do this setting using the Microsoft Frontpage, select the image >> right click >> properties >> in the border size =2, enter the value as "0". thats it ! now the image thats linked wud not have any border lines !!

Member Avatar for diafol
a img{
  border:none; /* or use border:0; - does the same thing here */
}

The image element is enclosed within a link tag, so ensure that this is represented in the css, otherwise all image styles will look like link images. However, if you don't want link images to look different from normal images (all images look the same regardless of whether they're links or not, just do this:

img{
  border:none; /* or use border:0; - does the same thing here */
}

I'd advise you to stay clear or html attributes like border="0". HTML is for logic, CSS is for styling. Try not to mix them.

See

http://www.w3schools.com/tags/tag_img.asp

It will tell you that border attributes are deprecated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.