Search code examples
cssdrupal-7

Drupal 7 width of CSS border-bottom on menu first level and sub-menus not consistent


I wish to include a border top on my menu items at this page, see the vertical menu block at the side. However, I wish to make the border top separator lines of the sub-menus to expand to full width, consistently to stretch to the left and right margins of the menu block/first level items. This way line separators are consistent across all first level and sub-menu levels.

Code line inserted:

border-top: thin solid #D7D6D6;

Btw, I am editing an out of the box Drupal 7 CSS file, indicated where I made the changes. See the full CSS styling page here.

Full code sample below:

/**
 * @file
 * Styles for menus and navigation markup.
 */

/**
 * Markup generated by theme_menu_tree().
 */
ul.menu {
  border: none;
  list-style: none;
  text-align: left; /* LTR */
}
ul.menu li {
  margin: 0 0 0 0.5em; /* LTR */
}
ul li.expanded {
  /* Jerome, disabled list styles on main menu sidebar
  list-style-image: url(../../misc/menu-expanded.png);
  list-style-type: circle;*/
}
ul li.collapsed {
  /* Jerome, disabled list styles on main menu sidebar
  list-style-image: url(../../misc/menu-collapsed.png); /* LTR 
  list-style-type: disc;*/
}
ul li.leaf {
  /* Jerome, disabled list styles on main menu sidebar
  list-style-image: url(../../misc/menu-leaf.png);
  list-style-type: square;*/

}
li.expanded,
li.collapsed,
li.leaf {
  /* increased padding, added border bottom between menu items
  padding: 0.2em 0.5em 0 0; */ /*  LTR */
  padding: 0.2em 0.5em 0 5px;
  margin: 0;
  border-top: thin solid #D7D6D6;
}
li a.active {
  color: #000;
}
td.menu-disabled {
  background: #ccc;
}

/**
 * Markup generated by theme_links().
 */
ul.inline,
ul.links.inline {
  display: inline;
  padding-left: 0;
}
ul.inline li {
  display: inline;
  list-style-type: none;
  padding: 0 0.5em;
}

/**
 * Markup generated by theme_breadcrumb().
 */
.breadcrumb {
  padding-bottom: 0.5em;
}

/**
 * Markup generated by theme_menu_local_tasks().
 */
ul.primary {
  border-bottom: 1px solid #bbb;
  border-collapse: collapse;
  height: auto;
  line-height: normal;
  list-style: none;
  margin: 5px;
  padding: 0 0 0 1em; /* LTR */
  white-space: nowrap;
}
ul.primary li {
  display: inline;
}
ul.primary li a {
  background-color: #ddd;
  border-color: #bbb;
  border-style: solid solid none solid;
  border-width: 1px;
  height: auto;
  margin-right: 0.5em; /* LTR */
  padding: 0 1em;
  text-decoration: none;
}
ul.primary li.active a {
  background-color: #fff;
  border: 1px solid #bbb;
  border-bottom: 1px solid #fff;
}
ul.primary li a:hover {
  background-color: #eee;
  border-color: #ccc;
  border-bottom-color: #eee;
}
ul.secondary {
  border-bottom: 1px solid #bbb;
  padding: 0.5em 1em;
  margin: 5px;
}
ul.secondary li {
  border-right: 1px solid #ccc; /* LTR */
  display: inline;
  padding: 0 1em;
}
ul.secondary a {
  padding: 0;
  text-decoration: none;
}
ul.secondary a.active {
  border-bottom: 4px solid #999;
}

Solution

  • Add this to your main.css

    ul.menu li ul li {
        margin: 0 -0.5em;
        padding: 0.2em 1em 0 1em;
    }