How to create a custom K2 Scheme: Part 2

ADVERTISEMENTS

Yesterday I explained on how to customize the body, page, header and footer. Today I shall cover on how to customize the main menu of your K2 blog. If you have missed the first part of this series, please read that before you continue.

Main menu

The main menu can be customized in many ways, the default being the horizontal tabs below the header. You can customize it to be above the header, on the sidebar or you could just change the tabs to some thing more better. After learning CSS, you will be able to use these ideas to create your own unique look.

Menu above the Header

ul.menu {
margin-bottom: 12px;
padding-left: 10px;
width: 90% !important;
word-spacing: 0;
}

In the above code,

Increase the value of margin-bottom until you get the menu to reach above header

padding-left lets you move the menu away from the default left side

width lets you control the spacing between the links in the menu

word-spacing lets you control the space between the words

You can adjust the font-size and default color of Menu links with this code

ul.menu li a {
font: 1em Verdana, Helvetica, Arial, Sans-Serif;
color: #ffffff;
font-weight: bold;
}

With the following code you can change the hover properties of the menu

ul.menu li a:hover{
background: #76a6d4 !important; /* hover background menu item color */
color: #ffffff !important; /* text color when hovered */
}
ul.menu li.current_page_item a,
ul.menu li.current_page_item a:hover {
color: #003366 !important; /* active tab hover text color */
background: #ffffff !important; /* active tab background color */
}

Play with the above code until you get the effect you want

Menu in the Sidebar

Paul Stamatiou has a good tutorial describing how to move your menu to the sidebar.

If you’re looking for an alternative design and want to get your blog to look much more unique, a sidebar menu may be the way to go. Here’s the break down of how this customization works: snag the menu code from header.php, paste it at the top of sidebar.php, add lots of CSS, enjoy.

Open up header.php and find the following code snippet and cut it out. Save header.php.

Edit sidebar.php so that the top of your file looks like the code below. Notice how I changed the ul class to sbmenu. This was purely aesthetic but naming it like this is good coding style, with the sb prefix denoting sidebar usage.






  • current_page_item< ?php } else { ?>page_item< ?php } ?>”>”>Weblog


  • ’,”); ?>


    Use the following CSS to begin with.

    /* Sidebar Menu */
    ul.sbmenu{
    padding-top: 5px;
    margin-top: -34px; /* Moves the menu up into the header image */
    margin-left: 0px !important;
    }
    ul.sbmenu li{
    display: block;
    line-height: 1.1em;
    margin-left: -10px !important;
    padding-left: 10px;
    }
    ul.sbmenu li:hover{
    background: #d5d5d5 !important;
    width: 216px;
    margin-left: 0px;
    }
    ul.sbmenu li a {
    font: 2em Helvetica, Verdana, Arial, Sans-Serif;
    text-transform: lowercase;
    color: #666;
    width: 216px !important;
    display: block;
    margin: 0;
    border: 0;
    }
    ul.sbmenu li a:hover{
    background: none !important;
    text-decoration: none !important;
    color: #000;
    }
    ul.sbmenu li.current_page_item a,
    ul.sbmenu li.current_page_item a:hover {
    color: #333 !important;
    background: none !important;
    text-decoration: none;
    }
    ul.sbmenu li.current_page_item{
    background: #CCC !important;
    width: 216px;
    margin-left: 0px;
    }

    Modify the above code to match your blog

    If you would like to use a background image for the menu items, add the appropriate url for the backgrounds of ul.sbmenu li.current_page_item and ul.sbmenu li:hover.

    Do not stop here, using these codes as a base you can design your own unique menu that makes your blog stand out.

    Continue reading Part 3 and Part 4

banner

Search JohnTP.com or view a random post

To receive this blogs articles for FREE on your email inbox, just enter your email address below and click 'Go':

Enter your email address: or .

Find out what I am doing currently by .

13 responses so far,

  1. 1

    Grace

    June 10, 2006 at 10:48 pm

    Nice tutorials John…

    will surely use some inputs for my blog designing :)

  2. 2

    basu

    June 11, 2006 at 8:20 am

    Very good work. Thanks. How about some screenshots?

  3. 3

    Nipon

    June 11, 2006 at 8:56 pm

    Great job.

    Can you tell me one thing? How can I preview my CSS code — like one can do with HTML?

  4. 4

    johntp

    June 11, 2006 at 10:32 pm

    Nipon- Which text editor do you use?

  5. 5

    Nipon

    June 14, 2006 at 2:08 pm

    i use dreamweaver.

  6. 6

    johntp

    June 14, 2006 at 3:47 pm

    I have not used Dreamweaver for some time now so I dont remember how to preview CSS in it. I have always prefered designing sites myself using notepad to using WYSIWYG Editors.

  7. 7

    Nipon

    June 15, 2006 at 11:55 am

    ok. when i hover a link in the header menu, i can see a blue color which is default in k2. how do i change that? which part of css should i edit for that?

  8. 8

    johntp

    June 15, 2006 at 2:46 pm

    Nipon- I have already given the CSS to change hover property. Please read the tutorial. It isnt hard to find.

    Check the third code box.

  9. 9

    Nipon

    June 16, 2006 at 12:55 am

    ur blog rocks and hats off to you for all these great tips and tuts.

  10. 10

    Manas

    August 9, 2006 at 11:18 pm

    Using your tutorials to create an unique style for my blog..
    Thanks for these.



Copyright ©2005-2008 JohnTP, All rights reserved.