CSS image link attributes

This is a discussion on "CSS image link attributes" within the Web Page Design section. This forum, and the thread "CSS image link attributes are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 18th, 2007, 01:29
New Member
Join Date: Sep 2007
Location: rva
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
CSS image link attributes

Hi, My image links are taking on the attributes of text links (bottom border, specifically) how can i declare image link propertiesusing css that will over ride the text link properties?

Thank you for any help,

L
Reply With Quote

  #2 (permalink)  
Old Nov 18th, 2007, 11:54
Junior Member
Join Date: Jul 2007
Location: Arkansas, USA
Age: 21
Posts: 45
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to nashultz07 Send a message via MSN to nashultz07
Re: CSS image link attributes

In the image code set border="0" and that should be all that you have to change.

Your code should look something like this (example has basic image coding):
Code: Select all
<img src="URL" border="0">
Hope this helps!
Last Blog Entry: First Post! (Apr 18th, 2008)
Reply With Quote
  #3 (permalink)  
Old Nov 18th, 2007, 15:31
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

It's better to do this with css. Img borders will not override the css-determined border. Put this into your css:
Code: Select all
a img {
border: 0;
}
Or, if you do not want this to apply to all anchored images, only a few, use the following:
Code: Select all
img.unstyled {
border: 0;
}
And put this into your img tag:
HTML: Select all
<img src="mypicture.gif" class="unstyled" />
That should do it...

Cheers,
Stuart
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #4 (permalink)  
Old Nov 19th, 2007, 12:55
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

Quote:
Originally Posted by nashultz07 View Post
In the image code set border="0" and that should be all that you have to change.

Your code should look something like this (example has basic image coding):
Code: Select all
<img src="URL" border="0">
Hope this helps!
The border attribute is deprecated for IMG and OBJECT elements.

See swagner's reply.
Reply With Quote
  #5 (permalink)  
Old Nov 20th, 2007, 03:49
New Member
Join Date: Sep 2007
Location: rva
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

Hey guys, thanks for all the help. I tried to add

a img {
border: 0;
}

to the css, but I don't think it did the trick, although it seems to have worked in IE. I'm checking it in firefox with no change, though. Here is the site if it helps. I'm sure there are a hundred more erros y'all will see haha.. i'm just trying to figure this underline out..

thanks again!
Reply With Quote
  #6 (permalink)  
Old Nov 20th, 2007, 12:45
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

You forgot the link!
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #7 (permalink)  
Old Nov 23rd, 2007, 21:43
New Member
Join Date: Sep 2007
Location: rva
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

haha. whoops. http://www.timbarryrva.com
Reply With Quote
  #8 (permalink)  
Old Nov 23rd, 2007, 21:51
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS image link attributes

Woah! What's with the frames? NOT GOOD! However, I found the css:
Code: Select all
<style type="text/css">
<!--
body {
    background-image: url(images/blback.gif);
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
body,td,th {
    color: #FFFFFF;
}
body,p,td{
font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;
font-size:11px;
text-align:justify;
}
.text{
font-size:10px;
}
.bigtext{
font-size:12px;
font-weight: bold;
}
.datetext{
color: #5A5A3A;
font-size:13px;
font-weight: bold;
}
H1
{
    color: #5A5A3A;
    font: 2em Arial, Verdana, sans-serif;
    font-weight: bold;
}
a img {
border-bottom: 0;
}
a:link {
    color: #8F8F8F;
    text-decoration: none;
    border-bottom: 1px dotted #888;
}
a:visited {
    color: #8F8F8F;
    text-decoration: none;
    border-bottom: 1px dotted #888;
}
a:hover {
    color: #8F8F8F;
    text-decoration: none;
    border-bottom: 1px dotted #888;
}
a:active {
    text-decoration: none;
}
a img {
border-bottom: 0;
}

-->
</style>
Now, what I highlighted in red, needs to go! That should not be inside a css document.

Back to the problem. Try using border-bottom: none; for the 'a img' styling. '0' and 'none' are sometimes read differently by browsers. Then, also get rid of ':link' from in front of the 'a' styling. The anchors can be addressed by simply using:
Code: Select all
a {
styles: whatever;
}
':link' is unnecessary and might be causing the problem.
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)

Last edited by Stuart; Nov 23rd, 2007 at 21:55.
Reply With Quote
  #9 (permalink)  
Old Nov 27th, 2007, 03:27
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,602
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS image link attributes

you could combine this two css into one!
HTML: Select all
a:visited, a:hover {
 color: #8F8F8F;
 text-decoration: none;
 border-bottom: 1px dotted #888;
}
and you could put a class in your link for your link that contain image
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Background Image as a Link? TheLion Web Page Design 4 Jan 18th, 2008 11:28
Positioning an image with a link pregnantNproud Web Page Design 8 Aug 12th, 2007 01:33
Navigation, different image per link konnor5092 Web Page Design 6 Jun 30th, 2007 17:46
Link pop up box from hotspot image MonaE JavaScript Forum 1 Jan 15th, 2007 00:43
What is the best way to link an image with a record in mysql AdRock PHP Forum 2 Aug 1st, 2006 12:10


All times are GMT. The time now is 04:51.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43