Log in

View Full Version : Correct format or not?



ashokbe
07-21-2011, 10:06 AM
<div> element inside the anchor<a> tag, ordered/unordered list tag and etc is correct html format or not.....

coothead
07-21-2011, 11:34 AM
Hi there ashokbe

it is not permisible to place...
block level elements (http://www.validome.org/doc/HTML_uk/block.html)
...within...
inline elements (http://htmlhelp.com/reference/html40/inline.html)
coothead

traq
07-21-2011, 03:08 PM
in html4, this is correct. however, it works in all modern browsers (though it is sometimes "buggy" in Internet Explorer), and it is valid in html5.

griffinwebnet
07-21-2011, 06:57 PM
Technically it should work but why are you putting a div into an anchor? If it is so you can make the anchor have a specific appearance, it may be easier and less buggy to make your list inside a div, then but the style attributes of your <div> apply to the anchor inside the list. For example:

(Style.css)


div#yourdiv ul li a
{
/* Put your properties here */
}


(index.html)


<div id="yourdiv">
<ul>
<li><a>Your anchor text here</a></li>
</ul>
</div>



-JL Griffin