473,770 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5861
"Greg Raven" <gr**@racquette ch.com> wrote in message
news:gr******** *************** *@tribune.sj.sy s.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******@bigNO SPAMpond.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******@earth link.net> wrote in message
| "Andrew Thompson" <an******@bigNO SPAMpond.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.

Miscommunicatio n 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**@racquette ch.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_theodo rakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #5
"Andrew Thompson" <an******@bigNO SPAMpond.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.

Miscommunicati on 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**@racquette ch.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
1947
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" --> config.asp read values from a database, which are used to populate colours within the styles.asp sheet - for example, styles.asp looks
22
5149
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 page? Or should they be used at all? Lately, I've been leaning towards the last option because my thought is that most browsers have a method to make it back to the top of the page (home button, scroll bar, whatever). It seems I never use the...
4
4836
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 value of the "id" field of that record as a URL parameter. Can someone tell me how to do this.
2
7026
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 header. I tried to put the link tag in the Master page, but the classes are not recognized in the Content Page. How do I use a StyleSheet with the Content Page? TIA
2
1756
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 both SeaMonkey (mozilla) and IE6, but in IE6 the link isn't clickable. It shows the destination URL in the status bar but the cursor remains an arrow and nothing happens when I click. In SeaMonkey it works just fine.
2
1483
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 new to Java Script, and trying to learn it as a hobby. I'm stuck! It matters not if cards match or not. The link to the game is here: http://www.tpgames.net/gaming/2/memory/MemoryWORK/jyzmemwork.html Thanks in advance! <!--
16
16825
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 {color: #0000ff;} a:visited:hover {color: #FFD; background-color: #0000ff;} a:link:hover {color: #FFD; background-color: #0000ff;}
4
7715
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 and images are not displayed. I mean, if I run application from Visual Studio at about 80% of times the styles and images are not applied - black and white page without images (only rectangular ares). I am not sure but I think I saw this effect on...
27
3878
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. random div's everywhere Is there any other way? Also I'm trying to get a scaled thumbnail of the orginal picture WHILE maintaining the size of the css box.. Is that possible? Or do I have to scale it in Photoshop and make a separate image =\
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.