View Full Version : Resolved Applying Attributes for a child's parent
X96 Web Design
02-28-2009, 04:06 AM
Sorry if the title isn't that great - I couldn't think of the right wording...
My problem is that the links on my site have a "border" attribute applied to them, but I don't want this border-bottom to appear below the linked images.
So what I'm trying to figure out is how to tell it that if there's an "a" tag with an image inside it, the a tag has special attributes applied to it (in my case, no border)
Is this even possible? If so, can someone please help me out?
The site where this is is :: http://x96wd.tech.officelive.com/
Please don't give me feedback on the design - I'm working on it!
Thanks in advance.
Schmoopy
02-28-2009, 04:25 AM
I'm going to suppose you mean the "red menu" here : http://x96wd.tech.officelive.com/red-menu.html?
Anyway, I think what you want to do is add "border:none" to #menu ul li a:
#menu ul li a {
color:#FFF;
text-decoration:none;
padding:15px;
margin:0;
background:transparent;
margin-left:-4px;
border:none;
}
This will get rid of any borders for any links on the menu, you could always move it to #menu ul li - if you add an item without a link in the future.
Hope that helps.
X96 Web Design
02-28-2009, 05:20 AM
Actually, it was for the back button (which I haven't added to that page... I'll get right on that...).
But thanks for pointing out the menu, I forgot about that...
EDIT: I just added the Back button... It's at the very top above the Heading.
Snookerman
02-28-2009, 08:26 AM
Unfortunately there is no way to target the parent of an element with CSS, not even with CSS3. You have two options (that I can think of). The simplest one would be to just give the anchor tags that you want to target (i.e. the ones containing images) a class value, e.g.:
<a href="/" class="imageanchor"><img src="back.png></a>
Then use CSS to remove the border.
Another option is to use JavaScript to target the anchor tags that have image tags as child elements (jQuery would be easy to use for this). This is of course more complicated and will not work if JavaScript is turned off. I would only recommend this if you for some reason cannot ad a class value to the anchor tags.
Good luck!
X96 Web Design
02-28-2009, 06:54 PM
I just updated the links so they just have a underline attribute, no borders any more...
Thanks anyway, though!
Snookerman
02-28-2009, 07:01 PM
You're welcome, glad to help!
You can go to your first post in this thread, click http://www.dynamicdrive.com/forums/images/buttons/edit.gif then click Go Advanced and add the Resolved prefix to the thread title.
This will let other users know the problem has been solved.
Good luck with your site!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.