Support » Themes and Templates » <div></div> breaking the design if put in sidebar.php

  • da_silva


    hi guys i have this problem: i want to list the childs of the currently browsed category and thus i’ve placed in the sidebar.php the usual

    <?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=2&hide_empty=0')

    I also need to custom the background image in the list so i put the code in a div but it breaks the design. The code is:

    <div><?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=2&hide_empty=0') ?></div>

    I don’t know what the problem is because this line, placed anywhere in the sidebar both in the default theme and mine-which i suspected to be to blame- breaks the layout.
    oh and the problem is only in IE browser, the others handle well the code, at least the error isn’t seen at layout level.

Viewing 2 replies - 1 through 2 (of 2 total)
  • da_silva


    i got it, sorry for bodering, the whole problem was not placing the div in a <u> in the list. So it was my lack of knowledge in css, i didn’t know this is wrong:
    <div><?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=2&hide_empty=0') ?></div></div>

    but i should have written like this:
    <div><?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=2&hide_empty=0') ?></div></div>

    I don’t know for sure if it’s correct but works. 😉



    No, its not correct. When using <div> elements, you have to put
    <ul>, <li> inside the <div>

    It should be:
    <?php wp_lists_cats(your specs here); ?>

    wp_lists_cats generates a list of category links with <li> already embedded into the code.

    And it really is bad form to put <div> inside an <li> like you’ve done.

    Check your validation html

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘<div></div> breaking the design if put in sidebar.php’ is closed to new replies.