Personal computing discussed

Moderators: renee, SecretSquirrel, just brew it!

 
Crayon Shin Chan
Minister of Gerbil Affairs
Topic Author
Posts: 2313
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia
Contact:

XHTML help!

Sat Feb 21, 2009 11:32 am

Here's my blog. Notice the two images on the right side of the banner, that change opacity as you mouse over them.
http://ritchan.dasaku.net

http://validator.w3.org/check?uri=http% ... aku.net%2F
W3C says <div> inside <a> is illegal. The rest of the errors are easily fixed... but I like to have my theme compliant, at least. How do I achieve the same thing in a compliant way?
Mothership: FX-8350, 12GB DDR3, M5A99X EVO, MSI GTX 1070 Sea Hawk, Crucial MX500 500GB
Supply ship: [email protected], 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Thinkpad X230
 
Flying Fox
Gerbil God
Posts: 25690
Joined: Mon May 24, 2004 2:19 am
Contact:

Re: XHTML help!

Sat Feb 21, 2009 12:24 pm

Switch the <div> and <a> around?
The Model M is not for the faint of heart. You either like them or hate them.

Gerbils unite! Fold for UnitedGerbilNation, team 2630.
 
titan
Grand Gerbil Poohbah
Posts: 3376
Joined: Mon Feb 18, 2002 7:00 pm
Location: Great Smoky Mountains
Contact:

Re: XHTML help!

Sun Feb 22, 2009 1:23 pm

Flying Fox wrote:
Switch the <div> and <a> around?

++
This won't actually effect anything, but will bring you closer to standards compliance. Unless, you want the whole block to be clickable, in which case, take what you've specified for the div in terms of margins, borders and padding, and specify it for a.

Additionally, marking things up appropriately in the first place reduces how much fixing you have to do later. (e.g.: &amp; instead of &.)
The best things in life are free.
http://www.gentoo.org
Guy 1: Surely, you will fold with me.
Guy 2: Alright, but don't call me Shirley.
 
titan
Grand Gerbil Poohbah
Posts: 3376
Joined: Mon Feb 18, 2002 7:00 pm
Location: Great Smoky Mountains
Contact:

Re: XHTML help!

Sun Feb 22, 2009 1:38 pm

I've been doing a little more looking into your source, and you didn't specify the language either:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
The best things in life are free.
http://www.gentoo.org
Guy 1: Surely, you will fold with me.
Guy 2: Alright, but don't call me Shirley.
 
Crayon Shin Chan
Minister of Gerbil Affairs
Topic Author
Posts: 2313
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia
Contact:

Re: XHTML help!

Mon Feb 23, 2009 1:39 pm

OK so I switched the div and a around. Now they're unclickable (there's no link). I haven't specified any margins, borders or padding for the div class, but I have specified its width and height. I apply that to <a>. Boom, the unclickable image disappears.

Is there another way of doing this? EDIT: fixed by setting display:block. I found that works sometimes for disappearing elements.
Mothership: FX-8350, 12GB DDR3, M5A99X EVO, MSI GTX 1070 Sea Hawk, Crucial MX500 500GB
Supply ship: [email protected], 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Thinkpad X230
 
cubical10
Gerbil First Class
Posts: 184
Joined: Fri Mar 03, 2006 2:52 pm
Location: Montreal

Re: XHTML help!

Mon Feb 23, 2009 3:28 pm

1. Take the styling you applied in your stylesheet, and move it from the div to the anchor tag.
2. Remove the background-image from the style.
3. Add an img tag within the anchor, and set the src pointed to the original background image.
4. Style new img tag as needed, borders etc...

Verify functionality, revalidate with w3.

Note, this is based on the original markup when you first posted.
Cubical 10
I only know enough to be dangerous.

Do ubuntu? pfsense

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On