homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Trying to validate xhtml
I have ul inside div and needs fixing

 3:26 am on Aug 9, 2012 (gmt 0)


I am trying to validate my xhtml. It says I have UL inside div and I am not sure how to fix. Can anyone help? This is on the sidebar for wordpress.


<div id="blog_left_box">

<br />
<ul class="side-box">
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php get_search_form(); ?>

<ul role="navigation" class="side-box">
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>

<?php wp_get_archives('type=monthly&limit=6'); ?>

<?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>

<div class="clear"></div>



 3:48 am on Aug 9, 2012 (gmt 0)

It says I have UL inside div and I am not sure how to fix.

There's something you're not telling us. A div can always be outside other stuff; the only limits are the other way around, on where you're allowed to insert a div. And, of course, straddling tags: if the UL starts inside a div, it has to end within that same div.

I count five separate php calls. The validator doesn't see those; it sees the resulting html. So there could be absolutely anything lurking in there:

inside the first <ul> but before its first <li>

inside the first <li>..</li> within that <ul>

inside the second <ul> but before its first <li>

inside a third <ul> nested inside a <li> in the second <ul>

after the last </li> but inside its containing </ul>

That is an awful lot of places where something could happen that the validator would complain about.


 4:00 am on Aug 9, 2012 (gmt 0)

Thanks Lucy24. You are correct. That is the problem as the designer did nest the following code:

'after_widget' => '<div class="side-box-btm"></div>',
'before_title' => '<div class="side-box-head">',

The designer nested all these instead of having good programming.


 5:41 am on Aug 9, 2012 (gmt 0)

People still use xhtml?

Guess I'm so deep into responsive HTML 5 that I failed to notice!

The designer nested all these instead of having good programming.

I'm a programmer so let's get our terms correct. HTML isn't programming, it's a Hyper Text Markup Language and XHTML is just an XML flavor that's eXtensible HTML. It's no more programming than typing a document in MS Word. However, Javascript or PHP used in a web page is actual programming. :)

Nothing wrong with nesting, everyone does it, I do it all the time, but you have to nest correctly to avoid errors. Without nested DIVs many of the irrationally tablephobic web designers out there would be incapable of generating tabular or column layouts.

FYI, depending on how far you are in the project, and if you aren't committed to XHTML, you could use an HTML 5 framework, several good FREE ones, and get one website that scales from a big desktop monitor all the way down to a cell phone for the same price as developing a regular site that won't function so well on smaller devices.


 6:03 am on Aug 9, 2012 (gmt 0)

ok, thanks bill


 10:13 am on Aug 9, 2012 (gmt 0)

You can do both HTML 5 and xhtml in one go: polyglot (x)html5 - It rocks in all possible directions. I'm actually redoing a production site from old xhtml 1.1 into polyglot (x)html5: It's so much easier to have the browser validate the wellformedness all the time, it's also easier getting "that browser" (IE) to properly do CSS for some reason (as it thinks -well actually is- getting html5 while the rest of the browsers get xhtml5)!

See here for more links to what it means: [webmasterworld.com...]

But I do agree xhtml1.1 should not be developed any longer, neither should HTML4 be used anymore. (x)html5 is the way forward. And the polyglot variant is IMHO the best choice right now if you want to get to xhtml5 without having to abandon IE users.


 5:55 am on Aug 20, 2012 (gmt 0)

What I wanted to say to swa66 was that I too am a HTML5 Polyglot advocate - the Homepage URL in my user profile will take you to my HTML5 Polyglot exemplar page.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved