when im writing html code inside of anchor tag, my dreamweaver editor showing bug in anchor tag. Shouldnt use inside tag? Is there any rules writing/using tags ?
I am using Html 5. This is my code. http://jsfiddle.net/CfPnj/
when im writing html code inside of anchor tag, my dreamweaver editor showing bug in anchor tag. Shouldnt use inside tag? Is there any rules writing/using tags ?
I am using Html 5. This is my code. http://jsfiddle.net/CfPnj/
<ul>
is a block element tag, and<a>
is an inline element tag - and block element tags should never go inside inline element tags, only the other way around (or inline element tags inside other inline element tags)...Start here, and then google for more: http://line25.com/articles/10-html-tag-crimes-you-really-shouldnt-commit
You don't have to put code inside the anchor link, because when you click on the link you will be redirected at the top of the anchor so you don't need writing all your code in the
<a>
In HTML5, you can put block elements insize
<a>
elements. See http://dev.w3.org/html5/markup/a.html#a-changesThis is new in HTML5. In any other version of HTML, it's illegal.
Update (added later, when I understood HTML5 better)
This is because
<a>
's content model was changed from inline to transparent. In other words, what you can put inside an<a>
is now the same as what you can put in<a>
's parent. The actual answer to the question here is, "it depends".For instance,
is perfectly valid HTML5, while
is not (because
span
is an inline element).Hope this helps!
According to http://validator.w3.org this is valid in HTML5
but not in HTML4.1 (strict)
but it doesn't feel right semantically (to me) to do this :-)
Looking at the specification a
<ul>
is allowed Where flow content is expected and<a>
is categorized as flow content.In general, inline elements only allow other inline elments as children. If you check the HTML 4.01 Doctype Definition, you will see that this is indeed the case for
<a>
tags (line 342). Your IDE is correct to mark a<ul>
tag inside an<a>
tag as invalid, although most browsers will still 'do the right thing'.Are you trying to do something like this:
Its syntactically right as per HTML rules, well since HTML does not show any
error
thus it is showed up asbug
in your dreamweaver.It will sowing something like this:
- Google.com
- Gmail.com
But both the links have same location google.com.
I thought you are trying to do something like this:
It will be rendered as:
And that is without any bug..