doushu9253 2019-08-08 23:52
浏览 110

在CSS中为Joomla模板定义下拉菜单样式

I am trying to build a custom template from scratch for my Joomla 3.9 website. I am new to web design. I have been following several tutorials on how to set up menu style via CSS, but I cannot seem to find information on how to define the drop-down menu style. The menu items are defined in Joomla configuration, and the menu should be injected into the right place.

relevant lines from index.php:

<body> 
 <div class="nav">
    <nav>
        <jdoc:include type="modules" name="navigation" style="none"/>
    </nav>
 </div>
</body> 

And from template.css:

.nav {
  background-color:#FFA500;
  position: sticky;
  top: 0;
}


ul.nav { //this element needs centering
  margin:auto;
  width:80%;
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #FFA500;
}

ul.nav li {
  float:left;
  display:block;;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  border-right: 3px solid #bbb;
}

ul.nav li:last-child {
  border-right: none;
}


ul.nav li a{
  color: white;
  font-size: 20px
}

ul.nav li:hover {
  background-color: #e09100;
}

This code works fine for displaying the menu the way I want (except for not centering it in the screen, but that's not relevant) for simple menu items. However, if I add sub-menu items in Joomla Menu configuration, it gets all messed up. I want these sub-menus to be displayed in a drop-down fashion when the user hovers over the parent item with the mouse, but instead, right now these sub-menus are displayed below the parent item statically. Obviously, that's because I haven't written the code for that part yet. Problem is, I do not know how to define the style for these sub-menu items, because they are not defined in the CSS, but instead, provided by Joomla. I cannot find any relevant documentation that would tell me the keywords to hook up to these items. Can someone tell me how to turn these sub-menu items into a nice drop-down menu when the user hovers the mouse over the parent menu item?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试