Kentico CMS 6.0 Tutorial  

Menu design

Menu design

Previous topic Next topic Mail us feedback on this topic!  

Menu design

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Now you will learn how to change the design of the main menu. The main menu used on the sample Corporate Site is displayed using the Drop-down menu web part which is based on the CMSMenu server control.

 

The menu design depends primarily on the applied CSS styles. Here's an example of the CSS styles for the drop-down menu:

 

.zoneMenu .CMSListMenuUL

{

  list-style: none;

  margin: 0px;

  padding: 0px;

  position: relative;

}

 

.zoneMenu .CMSListMenuUL li

{

  float: left;

  padding: 0px 22px 0px 0px;

}

 

.zoneMenu .CMSListMenuUL li a

{

  color: #fff;

  text-decoration: none;

  display: block;

  height: 23px;

  font-size: 16px;

  line-height: 23px;

  padding: 0px 8px;

  border: 1px solid transparent;

  font-family: Arial;

}

 

.zoneMenu .CMSListMenuUL .CMSListMenuHighlightedLIfirst a,

.zoneMenu .CMSListMenuUL .CMSListMenuLIfirst a

{

  padding-left: 0px;

}

 

 

...

 

As you can see, these are standard CSS styles. You can modify the styles in the global CSS stylesheet of the given site.

 

The default menu looks like this:

 

tutorial_clip0084

 

Now we will change the background color of selected menu items to orange. Go to Site Manager -> Development -> CSS stylesheets and edit (Edit) the Corporate Site stylesheet. Select Top menu styles -> Horizontal in the right navigation panel. Change the highlighted line:

 

.zoneMenu .CMSListMenuHighlightedLI a,

.zoneMenu .CMSListMenuHighlightedLIfirst a

{

  color: #8cd2f8 !important;

background-color: orange;

  text-decoration: none;

}

 

Click OK to save the changes. When go to the live site now, you will see a menu like this:

 

tutorial_clip0085

 

Defining the style of a single menu item

 

Every document may have its own style that is used when the document is displayed in the menu. We will try to modify the style of the Home menu item. Go to CMS Desk -> Content and select Home from the content tree. Click Properties -> Menu. Here you can define:

 

Menu caption - the name of the document when it's displayed in a menu.

Show in navigation - indicates if the document should be displayed by navigation controls.

Show in sitemap - indicates if the document should be displayed in the sitemap.

Menu actions - sets special behaviour for when the menu item is clicked by a user. The link can be disabled, a JavaScript command can be executed, or a specified URL can be opened.

Menu design - sets styles applied to the document's menu item (standard, mouse-overed and highlighted).

 

Enter the following value into the Menu item style value (in the Menu item design section): background-color: red; and click Save Save. Click Live site. Click Services. The Home menu item is now displayed in red:

 

tutorial_clip0087