|
-
Mar 12th, 2013, 11:57 AM
#1
CSS - Remove border from linked image
I'm having a tough time removing the border from a linked image. My html looks like this:
Code:
<a href="home.html">
<img id="logo" src="Images/logo.bmp" alt="Dday9 Logo">
So far what I've tried is:
Code:
#logo img
{
border: 0px;
}
but that doesn't seem to work.
-
Mar 12th, 2013, 06:15 PM
#2
Re: CSS - Remove border from linked image
Zero values in CSS don't require units, so you just want "border:0" instead of "border:0px". You are also missing the closing </a> tag after the <img />.
or alternatively if you want to be more specific to just this image:
css Code:
a img#logo { border: 0; }
Some people say to clear the "outline" css property as well, but that's not advisable as it's used for accessibility reasons.
-
Mar 13th, 2013, 08:41 AM
#3
Re: CSS - Remove border from linked image
Thank you, that works perfectly. And also thank you for noticing that I'm missing my closing tag! But let me ask you a question, why do I have to declare a img before the #logo? For example, in my navigation bar, I just declare #navigation li:
CSS Code:
#navigation li
{
display: inline;
margin: 0;
list-style-type: none;
border:2px gray;
border-style: solid;
padding-right:50px;
padding-left:50px;
}
a img#logo { border: 0; }
Edit - And I love how the Syntax highlighter doesn't match with the highlight tags!
-
Mar 13th, 2013, 06:49 PM
#4
Re: CSS - Remove border from linked image
The element id's on each page should always be unique, so you're right in that it's not required.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|