View Full Version : Div tags in links
pavlick
11-21-2007, 10:27 AM
Please, help me to figure out: is it OK to put DIV tag into link like this:
<a href="http://some_url" title="test">
<div class="homepage_block_title homepage_block2_title">
<h1>Click here</h1>
</div>
</a>
Will it influence the search spider? will the link be indexed?
Thanks.
AussieWebmaster
11-21-2007, 11:19 AM
The link will be listed for the site it points to and the anchor text assosiated with it is Click Here - use a keyword
Well, it's not proper code and I'm not sure how different browsers would handle that situation.
As far as the spiders, also hard to say but my guess is that they would either see most of the code as anchor text, "Click Here" as anchor text and/or all of it as a broken link. By the way don't use "Click Here" http://www.w3.org/QA/Tips/noClickHere
Any other ideas?
Marcia
11-21-2007, 03:12 PM
It isn't OK, it isn't correct markup; it's wrong HTML and CSS.
div is a block level element. So are <p> and <h1> - h6, etc
<a> is an inline element. You don't put block level elements inside of inline. You put inline inside of block.
Follow beu's link and read up on the HTML specs and the specs for the CSS block model.
AussieWebmaster
11-21-2007, 03:19 PM
<div class="homepage_block_title homepage_block2_title">
<h1><a href="http://some_url" title="test">
Click here </a></h1>
</div>
that would work
Marcia
11-21-2007, 03:26 PM
Here's the section on learning CSS (http://www.w3.org/Style/CSS/) at W3. It's definitely worth a read. And so is running pages through the W3 validator for HTML and CSS, which is very quick and simple using Firefox with the developer toolbar.
Incidentally, I've moved this to the "technical issues" forum, since while pages don't have to validate 100%, and this isn't ultra serious, really serious HTML errors can cause difficulty in pages being parsed.
"Use a text browser such as Lynx to examine your site, because most search engine spiders see your site much as Lynx would..."
- http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=35769
I ran this with Lynx and got something interesting so, I thought I'd share.
Lynx Version 2.8.6dev.11 shows "Click here" as text and not as a link adding that the "Document has only hidden links."
"Click here
[Document has only hidden links. Use the 'l'ist command.]"