SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Oct 15, 2006, 21:15 #1
- Join Date
- Feb 2003
- Location
- eez
- Posts
- 331
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this bad practice XHTML? (block element coming directly after inline element)
Hi!
Is this bad practice XHTML?
<a href="google.co.uk">Aha!</a>
<ol>
<li>...</li>
...
</ol>
I mean a block-level element coming directly after an inline element. It is valid for the w3 validator in chtml strict mode (I don't trust it a yota though). Thanks!
-
Oct 15, 2006, 21:43 #2
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's valid, but not how I would do things.
I'd have the anchor inside a block level element, and then have the list come after that (the block level element, not the anchor).
For example:
HTML Code:<div> <a href="#">Some Link</a> </div> <ol> <li>List Item</li> <li>List Item</li> </ol>
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Oct 16, 2006, 03:18 #3
- Join Date
- Sep 2006
- Location
- Nottingham, UK
- Posts
- 3,133
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
What's wrong with a block element coming after an inline one?
-
Oct 16, 2006, 03:39 #4
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's a logical oddity. An element should normally contain either block-level elements or inline elements, not both. The HTML spec allows the mix, but it doesn't really make sense (not to me, at least).
When content like this is rendered by a CSS-compliant user agent, the inline elements will be surrounded by what is called 'anonymous block boxes', because it doesn't make sense to mix block-level and inline content at the same structural level.Birnam wood is come to Dunsinane
Bookmarks