What is valid markup inside an <A> tag

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

What is valid markup inside an <A> tag

Post by Stryks »

Hey all,

I'm working on a search results page, with each result item needing to show a fair chunk of data. Among other things, each item has an image, some text, and most likley a table as well.

My issue is that I want to have the whole result clickable as a link.

I'd prefer not to use javascript for this, as I always like to remove as much penalty as possible for js-disabled viewers.

Anyhow, I'm about to go start designing, but if nesting the content in the A tag is a no-no, it'd be good to know before I waste my time trying.

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Anchors are inline elements, therefore cannot have block elements inside them.
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Post by Stryks »

Bugger.

I did the test and it appears to work, but I dont know .... I'm doing a pretty major redesign and I'm trying to stay as close to the standards as I know them. I mean I've even reworked my concept design so I dont need CSS hacks.

On the bright side though, there is the image, and it's pretty dominant. I can link that and then put a button opposing it. Hopefully users attention will magnet to the image or the button.

Is there any other legit solution to make the whole item clickable, or you think the above alternative reasonable?

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There's layering an anchor over all the elements, but that's often iffy and typically requires Javascript at some point.

Proper design will typically alleviate the need to do such things, but it really depends on what you're displaying.

If this is a real problem, a redesign may be in order or at worst educating your users. ;)
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You can always give the anchor a display:block property.
Post Reply