• Resolved nathanrosen

    (@nathanrosen)


    My website is http://www.MicroHorror.com. I’m using a heavily modified (by me, not knowing much about CSS) version of Dave Shea’s Classic 1.6 theme. I’d like to use the dropdown option in the Categories and Archives widgets, but the long category names make the sidebar too wide and the screen has to be scrolled to the right. How can we fix this? Acceptable options include shrinking the size of the text in the dropdown menu or truncating the number of characters displayed.

    Thanks very much for your help.

Viewing 12 replies - 1 through 12 (of 12 total)
  • ambrosite

    (@ambrosite)

    You could save a little bit of horizontal space by changing the letter-spacing on that element to zero.

    http://www.microhorror.com/microhorror/wp-content/themes/classic.1.6/classic2/style.css (around line 233):

    #menu ul li {
    font: 90% ‘Times New Roman’,Times,serif;
    letter-spacing: 0.1em; /* <– change to 0 */
    }

    But ultimately, that select drop-down will be as wide as the longest entry in the list, so you are going to have to shorten them.

    Thread Starter nathanrosen

    (@nathanrosen)

    Thanks for the suggestion, but that’s not the solution, I’m afraid. I need to change the size of the text in the dropdown itself, or cut it off.

    can cut off by using overflow:hidden in the css

    I had to do same for a twitter widget in sidebar that used really long links

    ambrosite

    (@ambrosite)

    The change I suggested does in fact affect the text inside of the drop down. Try it.

    can cut off by using overflow:hidden in the css

    That will work, the only trouble is, the drop-down icon will be cut off as well, which creates a usability problem (it makes the drop-down list look like an input box).

    Thread Starter nathanrosen

    (@nathanrosen)

    If #menu ul li { affects the text inside the dropdown, then why am I still seeing it in sans serif? Shouldn’t it have switched to Times? Or is there something else I’m missing?

    ambrosite

    (@ambrosite)

    This might work:

    #menu ul li select {
    width: 150px;
    }

    ambrosite

    (@ambrosite)

    And you can change the font-size there, too:

    #menu ul li select {
    width: 150px;
    font-size: 0.8em;
    }

    Thread Starter nathanrosen

    (@nathanrosen)

    That’s great, ambrosite! Thank you! Is there any way to restore the vertical scroll bar now, or is it stuck like this? (If it’s stuck, I don’t mind; it’s still better than it was before.)

    ambrosite

    (@ambrosite)

    Hmmm, I hadn’t noticed that. No scroll bar is a serious usability problem.

    I can’t find any way to fix that using CSS. I assume the content of that list is being generated by wp_list_categories? It might be possible to add a filter to that function to truncate the titles.

    Thread Starter nathanrosen

    (@nathanrosen)

    It’s generated by the Categories widget, which I presume uses CSS in there somewhere. Do you know how to get into it?

    ambrosite

    (@ambrosite)

    I found a way to do it. First of all, remove the width from #menu ul li select that you added before. Now, put this in your functions.php:

    function truncate_list_cats($cat) {
            $limit = 15; // do not make this less than 15
            if(strlen($cat) > $limit) $cat = substr($cat, 0, $limit) . '...';
            return $cat;
    }
    add_filter('list_cats', 'truncate_list_cats');
    Thread Starter nathanrosen

    (@nathanrosen)

    Ha ha! You did it! I could kiss you! Thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Dropdown menus make my sidebar too wide.’ is closed to new replies.