Reply
Nesting Links
Old 02-13-2008, 06:38 PM Nesting Links
Experienced Talker

Posts: 40
Name: james
I would like to nest 5 links inside each other for a star rating system I am making for my site, like this.

Code:
<a class="5star" href="#">
<a class="4star" href="#">
<a class="3star" href="#">
<a class="2star" href="#">
<a class="1star" href="#">
</a>
</a>
</a>
</a>
</a>
but the browser tries to pair these colored pairs together
Code:
<a class="5star" href="#">
<a class="4star" href="#">
<a class="3star" href="#">
<a class="2star" href="#">
<a class="1star" href="#">
</a>
</a>
</a>
</a>
</a>
when I want it to pair these colored pairs together
Code:
<a class="5star" href="#">
<a class="4star" href="#">
<a class="3star" href="#">
<a class="2star" href="#">
<a class="1star" href="#">
</a>
</a>
</a>
</a>
</a>
Is their any way to make this work?
jamest is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 02-13-2008, 07:45 PM Re: Nesting Links
vangogh's Avatar
Post Impressionist

Latest Blog Post:
A Focused Blog Is A Happy Blog
Posts: 8,663
Name: Steven Bradley
Location: Boulder, Colorado
You can't nest links. It really doesn't make sense since it leaves no way for the browser to determine where the link should go.

You shouldn't need to nest links to create a rating system, though. Could you describe what you want to do with a little more detail. I'm sure we can walk you through creating the rating system or point you to a tutorial or pre-existing script.
__________________
l Search Engine Friendly Web Design | Van SEO Design
l Tips On Marketing, SEO, Design, and Development | TheVanBlog
l Custom WordPress Themes
| Small Business Forum
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 02-15-2008, 04:21 AM Re: Nesting Links
chrishirst's Avatar
Super Moderator

Posts: 12,815
Location: Blackpool. UK
http://www.w3.org/TR/html401/struct/links.html#h-12.2.2
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-15-2008, 03:01 PM Re: Nesting Links
Experienced Talker

Posts: 40
Name: james
OK, Thanks. I am pretty sure I can accomplish the same affect by putting links inside of divs and then nesting the divs. When I finish I will post it here so you guys can see what I was trying to do and how I got it to work.
jamest is offline
Reply With Quote
View Public Profile
 
Old 02-15-2008, 09:00 PM Re: Nesting Links
ozzozo's Avatar
Experienced Talker

Latest Blog Post:
Customer Support Whitepaper
Posts: 44
How about trying a horizontal list?

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title></title>
<style type="text/css">

#rating li
{
display: inline;list-style-type: none;padding-right: 10px;
}
</style>
</head>

<body>

<ul id="rating">
<li><a href="#">5</a></li>
<li><a href="#">4</a></li>
<li><a href="#">3</a></li>
<li><a href="#">2</a></li>
<li><a href="#">1</a></li>
</ul>

</body>
</html>
__________________
Universal FAQ Manager - FAQ Management Software
ozzozo is offline
Reply With Quote
View Public Profile Visit ozzozo's homepage!
 
Old 02-15-2008, 11:27 PM Re: Nesting Links
Experienced Talker

Posts: 40
Name: james
That wouldn't work for my purposes. The reason I want to nest links is so I can change the background of all links inside a certain link when I hover over it.

EDIT:This is the my new problem and I believe that it is all that is keeping my idea from working.

Why does this work and the image Star_Gold.png shows up.
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
div a {
padding-right:16px;
background:url(/Images/Buttons/Star_Gold.png) no-repeat 0 0;
}
</style>
</head>
<body>
<div class="1star"><a href="#"></a></div>
</body>
</html>
But this does not?
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
div.1star a {
padding-right:16px;
background:url(/Images/Buttons/Star_Gold.png) no-repeat 0 0;
}
</style>
</head>
<body>
<div class="1star"><a href="#"></a></div>
</body>
</html>
EDIT2:I just realized I am an idiot. I have been racking my brains to try and figure out why this didn't work when the only problem is that i started my class names with numbers.

Last edited by jamest : 02-16-2008 at 02:16 AM. Reason: new question
jamest is offline
Reply With Quote
View Public Profile
 
Old 02-16-2008, 02:20 AM Re: Nesting Links
Mattmaul1992's Avatar
Ultra Talker

Posts: 440
Name: Matt
So is it all figured out now?
__________________
PHP Code:
$talkupation++; 
http://www.forum-front.com/ - Free IPB forum hosting (releasing today!!!), no ads, free modifications
Mattmaul1992 is offline
Reply With Quote
View Public Profile
 
Old 02-16-2008, 02:37 AM Re: Nesting Links
Experienced Talker

Posts: 40
Name: james
I'm still working on the final touches but that solved most of my problems.
jamest is offline
Reply With Quote
View Public Profile
 
Old 02-16-2008, 05:54 PM Re: Nesting Links
Experienced Talker

Posts: 40
Name: james
I would like everyone to know that this is finished and that if you would like to view my resulting star rating system you can view it here.

If you use any of the code from this site please add a to http://jamest.bravehost.com/index.shtml(I am currently working on this site and thus haven't bought a domain name or added any content. I am hoping to have this site finished by the end of the summer.) from your site.

Currently this rating system does not work in IE due to the use of the CSS child selector. For best results it should be viewed with Mozilla Firefox(or other Mozilla based browsers).
jamest is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Nesting Links
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15954 seconds with 13 queries