473,394 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Turning off link styles for images

I styled my links just the way I want them using CSS, but now my linked
images have picked up these same styles. I've tried turning the styles
off for the images with:

a img
{
text-decoration: none;
outline: none;
margin: 0px;
padding: 0px;
border-width: 0;
border-style: none;
}

.... to no avail. I should mention that this CSS code is at the bottom of
my style sheet, which I understand should give it some measure of
preference.

What am I missing?
Jul 20 '05 #1
7 5840
"Greg Raven" <gr**@racquettech.com> wrote in message
news:gr************************@tribune.sj.sys.us. xo.net...
| I styled my links just the way I want them using CSS, but now
my linked
| images have picked up these same styles. I've tried turning the
styles
| off for the images with:
|
| a img
| {
| text-decoration: none;

I _suspect_* this is because the properties
you are seeing are not being applied to the
image itself, but to the link that encloses it..

* ..waiting for someone who knows lots
about styles to either..
a) confirm that or
b) call me a turkey and tell me to leave it
for those who know ;-)

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #2
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in
news:Ch******************@news-server.bigpond.net.au:
| a img
| {
| text-decoration: none;

I _suspect_* this is because the properties
you are seeing are not being applied to the
image itself, but to the link that encloses it..


On the contrary, the properties are being applied to the image, not the
link, and that's the problem. CSS doesn't provide any means to select an
element based on its descendants; there's no way to say "style an <a> that
contains an <img> differently from one that doesn't."

I think the OP will have to resort to putting a class attribute on links
that contain images.
Jul 20 '05 #3
"Eric Bohlman" <eb******@earthlink.net> wrote in message
| "Andrew Thompson" <an******@bigNOSPAMpond.com> wrote in
|
| >| a img
| >| {
| >| text-decoration: none;
| >
| > I _suspect_* this is because the properties
| > you are seeing are not being applied to the
| > image itself, but to the link that encloses it..
|
| On the contrary, the properties are being applied to the image,
not the
| link, and that's the problem.

Miscommunication on my part?
That is actually what I meant.

But just to clarify, the OP is _seeing_ the
border and such of the <a>, rather than the
<img> that is inside the <a>?

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #4
On 20 Jan 2004 16:15:24 EST, Greg Raven <gr**@racquettech.com> wrote:
I styled my links just the way I want them using CSS, but now my linked
images have picked up these same styles. I've tried turning the styles
off for the images with:

a img
{
text-decoration: none;
outline: none;
margin: 0px;
padding: 0px;
border-width: 0;
border-style: none;
}

... to no avail. I should mention that this CSS code is at the bottom of
my style sheet, which I understand should give it some measure of
preference.

What am I missing?


That seems needlessly complicated (although a url with an example
would be helpful here). Have you tried just :

a img
{
border: none;
}

Nick

--
Nick Theodorakis
ni**************@hotmail.com
nicholas_theodorakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #5
"Andrew Thompson" <an******@bigNOSPAMpond.com> wrote:
| >| a img
| >| {
| >| text-decoration: none;
| >
| > I _suspect_* this is because the properties
| > you are seeing are not being applied to the
| > image itself, but to the link that encloses it..
|
| On the contrary, the properties are being applied to the image,
not the
| link, and that's the problem.

Miscommunication on my part?
That is actually what I meant.

But just to clarify, the OP is _seeing_ the
border and such of the <a>, rather than the
<img> that is inside the <a>?


No, the border on a hyperlinked image is a property of the image.

--
Spartanicus
Jul 20 '05 #6
On 20 Jan 2004 16:15:24 EST, Greg Raven <gr**@racquettech.com> wrote:
I styled my links just the way I want them using CSS, but now my linked
images have picked up these same styles. I've tried turning the styles
off for the images with:

a img
{
text-decoration: none;
outline: none;
margin: 0px;
padding: 0px;
border-width: 0;
border-style: none;
}

... to no avail. I should mention that this CSS code is at the bottom of
my style sheet, which I understand should give it some measure of
preference.

What am I missing?


What you've done is stripped the images of all borders, which means no
link-colored border will be there.

a img {
border: 4px;
}

To restore colors, assign colors to a:link img, a:visited img etc.
Jul 20 '05 #7
DU
Greg Raven wrote:
I styled my links just the way I want them using CSS, but now my linked
images have picked up these same styles. I've tried turning the styles
off for the images with:

a img
{
text-decoration: none;
outline: none;
margin: 0px;
padding: 0px;
border-width: 0;
border-style: none;
}

... to no avail. I should mention that this CSS code is at the bottom of
my style sheet, which I understand should give it some measure of
preference.

What am I missing?


Others have already answered you on how to achieve borderless
link-images. But I advise against doing so. Just consider the
perspective of your visitors who know nothing of your site. How can they
figure out easily where are clickable images if you remove the color
around links (unvisited, visited, hovered ones) when these are clickable
images? Borderless link-images just diminishes the usability and
navigability of your site.

Same thing with outline. Even though outline is right now poorly
supported (only Opera 7.x supports it), I would advise not to remove the
default outline declaration of browsers for the same reasons: visual
feedback, easy identification of the last element with focus.

DU
Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mark | last post by:
Hi - in my current pages, I have: <link href="styles.css" rel="stylesheet" type="text/css"> What I would like to do is: <!--#include file="config.asp" --> <!--#include file="styles.asp" --> ...
22
by: Jonathan Snook | last post by:
I've been contemplating what the recommended usage of a "top of page" link should be? Should there only ever be one at the bottom of the page? Should they be sprinkled at various points on the...
4
by: Miguel Dias Moura | last post by:
Hello, I created a datalist in an ASP.Net / VB page. I display the image and price of a few products. When a user clicks an image I want to load the page "detail.aspx?number=id" and send the...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
2
by: John A. | last post by:
Hello. I'm trying to have an image (a GIF with transparency) overlayed on certain of several inline images that link to different pages. What I have so far looks right (or right enough) in...
2
tpgames
by: tpgames | last post by:
Me memory game freezes after I click some cards. I seems to be random as to the number of clicks needed before it freezes. I posted the entire code, as I am not sure what is needed for help. I am...
16
by: beakersoft | last post by:
Hi, I've only just started playing about with CSS so there might be a really obvious answer to this. In my style sheet i have the following to style the hyperlinks on the page: a:link...
4
by: R.A.M. | last post by:
Hi, I have created ASP.NET application with forms authentication (Login.aspx). The problem is that although Login.aspx contains CSS styles and JPEG/GIF images, usually the styles are not applied...
27
by: GloStix | last post by:
WARNING VIDEO TAKES A WHILE TO LOAD http://screencast.com/t/BWQ6DNtsM I really don't know how to fix this other than putting another div. But I dont' exactly want to do that for every page....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.