Links inside links with CSS?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Links inside links with CSS?

Post by allspiritseve »

I'm wondering if it's possible to create links inside links with CSS. I'm making an interface to navigate a hierarchy of content in a CMS, and each section has a list of content. If you click on the box containing the content, it will open a new listing with that content as the parent, and show all it's children (and so on as you navigate through the hierarchy). I'd also like to have links inside each box for editing, moving, or deleting each item... so far my attempts at doing this have failed, as styles applied to the parent a tag also apply to the a tags inside them. Any ideas?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Links inside links with CSS?

Post by pickle »

In CSS, you could apply different styles like:

Code: Select all

/* only apply to first level links */
.menu > a{
border:1px solid #333;
padding:3px;
}
.menu a a{
color:#fff;
font-size:0.75em;
}
However, I'm pretty sure you're not allowed to have nested <a> tags. It looks like you might need Javascript for this.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply