Jump to content

Entire DIV block as link in XHTML Strict


vineld

Recommended Posts

I am modernizing a site and in the process I have switched to XHTML 1.0 Strict. It did not mean too many changes in this case although there was one problem I ran into. There are quite large code blocks with mouseover effects that reside within a DIV. Inside there are several other DIVs, paragraphs and images. Changing this would mean some messy restructuring which doesn't sound very appealing to me.

 

Is there any good easy solution to this problem? I don't really wish to use JS since search engine bots may not like it. I am actually considering leaving it as is even though it doesn't validate. After all, it does work.

Link to comment
Share on other sites

Changing the doctype is just avoiding the issue and not a solution. Of course I have run it through a validator. I know what the problem is (block-level and inline elements), and so do most of you I assume, but I still need to find a neat solution that would preferably not include JS.

Link to comment
Share on other sites

Haha  ;) I'm not sure if that was a joke or just plain sarcastic  :P

 

The problem is actually very straight-forward. I need to use a block-level element as a link in an SEO friendly manner. Although I know that is not a good idea, that is how the code looks today and it's not really my fault.

Link to comment
Share on other sites

It was kind of a joke, kind of sarcastic - basically if you don't show us your code, it's pretty hard to give you any specific kind of help.

 

All I can say in a generally is expand your links to be the full size of the area they have to cover, then inside them you can use spans instead of divs - this could solve your problem.

Link to comment
Share on other sites

The old code is messy, output by php with inline css and therefore not very reader friendly. That was why I opted against displaying it in the first place. I don't really wish to replace any elements as they seem to be fairly logical as they are. I think I will go for this solution nonetheless:

 

1. Add a JS onclick link to the surrounding div for the link.

 

2. Add two separate html links for an image and a header which are the only relevant items for the target url itself.

 

This is really turning into SEO now I guess... Sorry about that. Would this solution be a good idea do you think or will the search engines frown upon this? After all, it may seem strange with two links for the same page and then a js link that surrounds them...?

Link to comment
Share on other sites

As far as your SEO is concerned, the search engines won't even see the javascript link - search engine bots are not javascript enabled.

 

The two links on the other hand - some people are of the opinion that that can be a bad thing. I'm not convinced myself, but I'm no SEO pro, just an intermediate.

Link to comment
Share on other sites

Thanks for your two cents. I think I'll stick with just using the text as a link since it doesn't really matter. What you said is not entirely true though. Even though the Googlebot can't execute javascript it does at times read javascript and might take that into account depending on the situation.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.