html - 在 html5 中使用 ul li 两次

标签 html css html-lists

我在我的导航栏中使用 ul li,同时也制作了一个布告栏。但我想分开 ul li 元素。有没有简单的方法,比如 nav ul li {} 和 notice board ul li{}

最佳答案

您可以为它们定义 CSS 类。例如:

.nav {
  /*some css*/
}


.notice_board {
  /*some css*/
}

然后将它们链接到所需的 HTML 元素

<ul class="nav">
 <li>...</li>
 ...
 <li>...</li>
</ul>

用于导航和

<ul class="notice_board">
 <li>...</li>
 ...
 <li>...</li>
</ul>

用于布告栏。

关于html - 在 html5 中使用 ul li 两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17957692/

相关文章:

javascript - 如何从Jquery正确调用JS

html - 如何通过将鼠标悬停在链接上来使隐藏的段落可见?

html - 剪辑动画 div

css - css 中的不透明度仅适用于 li 而不是其中的文本

html - 样式 <UL> 的第一个 child (不是子 <ul> 不添加 ID 或类)

html - 流畅的内联列表和行对齐

javascript - 我可以使用 JavaScript 更改 HTML 文档访问的 JavaScript 文件吗?

javascript - jQuery mobile 1.3.0 :"Uncaught Error: no such method ' 刷新'表格小部件实例“

html - 如何让输入框和图片对齐(或者居中)

internet-explorer - 使网站兼容IE7