css - Drupal 菜单中的样式

标签 css drupal menu drupal-7

我需要将样式放入 Drupal 菜单中。我有这段代码:

print theme('links', array('links' => menu_navigation_links($menu_area), 'attributes' => array('class'=> array('nav', 'navbar-nav')) ));

    具有“nav navbar-nav”样式,但
  • 具有我无法触摸的自定义 CSS 样式(首先是 menu-7053)。

    有什么办法可以用打印主题功能改变那个

  • 风格吗?

    谢谢。

最佳答案

不可以,您需要在主题中实现自己的 theme_menu_link 功能。

function YOURTHEME_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  $element['#attributes']['class'][] = 'my-custom-li-class'; // change here to desired css class name

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }

  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}

关于css - Drupal 菜单中的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28812208/

相关文章:

html - flex-wrap 导致下一行有太大的差距

jquery - 鼠标悬停时显示 float Div

jquery - jQuery 菜单的第三级不自动调整大小

css - Websitebaker 菜单失败

joomla - 在 Joomla 2.5 中,如何在所有页面上只显示一个根级项目的子菜单项?

html - 是否有类似 Webmaster's Toolkit 的东西可以在 Linux 上运行?

html - 我如何使用 HTML CSS 绘制线条?

php - 德鲁帕尔 6 : Programmatically Altering User Values

Drupal View : Adding Edit button and other buttons per item

drupal - 如何在更新模块之前检查是否需要更新数据库