【发布时间】:2019-08-16 03:03:57
【问题描述】:
我编写了一个 HTML 代码并合并了我自己的 CSS 代码以及 Bootstrap 4 代码。当我使用 CSS 文件时——我在引导声明后的标题中声明了它——引导导航栏的下拉功能不起作用。具体来说,单击该下拉菜单项无效。当我注释掉 CSS 引用或者只是在它的主目录之外运行 HTML 文件时(css 文件所在的位置),下拉菜单可以正常工作,但我当然会丢失我写入我的 css 文件的所有格式。
我的问题是:在我的 CSS 中,是什么阻止了导航栏中的引导下拉菜单工作?
body {
font-size:16pt;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; /* picks first
font in list order*/
color:brown;
background-color: #ffffcc;
line-height:18pt;
padding-left:24pt;
padding-right:24pt;
padding-top:5pt;
text-align:center;
border: double 2px green;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li a{
float: none;
}
li a {
display: block;
padding: 14 16;
background-color: #000000;
}
a {
text-decoration:none;
}
a:link, a:visited {
color:#8094d6;
}
a:hover, a:active {
color:#FF9933;
}
.active {
background-color: #4CAF50;
}
.center {
display: block;
margin-left: auto ;
margin-right: auto;
width: 20%;
}
a {
border-right: 1px solid #bbb;
}
a:last-child {
border-right: none;
}
* {box-sizing: border-box;}
h1{
font:18pt Verdana, Geneva, arial, Helvetica, sans-serif;
font-weight:bold;
line-height: 20pt;
}
h2{
font:16pt Verdana, Geneva, arial, Helvetica, sans-serif;
font-weight:bold;
line-height: 10pt;
}
subheader {
font-weight:bold;
color:brown;
}
img{
padding:3pt;
}
footer {
font-size: 9pt;
font-style:italic;
line-height:12pt;
text-align:center;
padding-top:30pt;
}
【问题讨论】:
-
请包含一个 jsfiddle(您可以创建一个包含引导程序的),或一个 HTML/CSS sn-p。很难重现您的问题并提出解决方案。
标签: html css bootstrap-4