Html 菜单和子菜单问题?
使用CSS样式表 在我的网页中,我有两个类,如菜单和左侧。在菜单上我有ul,li课程。我想在左边也用ul,li,但问题是如果我用ul,li,它与菜单ul,li匹配 ul-参考列表,li-列表 我试图更改工作表的代码 我的css代码Html 菜单和子菜单问题?,html,css,Html,Css,使用CSS样式表 在我的网页中,我有两个类,如菜单和左侧。在菜单上我有ul,li课程。我想在左边也用ul,li,但问题是如果我用ul,li,它与菜单ul,li匹配 ul-参考列表,li-列表 我试图更改工作表的代码 我的css代码 #leftside{ float: left; width: 230px; margin-left: 5px; margin-top: 15px; overflow: hidden; font: 13px Arial,
#leftside{
float: left;
width: 230px;
margin-left: 5px;
margin-top: 15px;
overflow: hidden;
font: 13px Arial, Helvetica, sans-serif;
}
a {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: maroon;
}
ul {
padding: 10px 10px 2px 0;
margin: 0px;
list-style: none;
}
li li {
margin-left: 10px;
margin-right: 10px;
line-height: 30px;
padding-left: 15px;
border-bottom: 1px dashed #BDBDBD;
background: url(images/img04.jpg) no-repeat left 50%;
}
Html代码
<li>
<ul>
<li><a href="#">Company Profile</a></li>
<li><a href="#">Enquiry</a></li>
<li><a href="#">Career</a></li>
<li><a href="#">Location Map</a></li>
</ul>
</li>
ul,列表与菜单ul,li匹配
如何解决这个问题。请。使用id来区分两者 例如,HTML将是:
<ul id="outter">
<li>The Outter List</li>
<li>More Outter List
<ul id="inner">
<li>This is the inner list</li>
<li><a href="#">Company Profile</a></li>
<li><a href="#">Enquiry</a></li>
<li><a href="#">Career</a></li>
<li><a href="#">Location Map</a></li>
</ul>
</li>
<li>Still The Outter</li>
</ul>
这看起来像这样:
#outter ul {
padding: 10px 10px 2px 0;
list-style: none;
}
#outter li {
margin-left: 10px;
line-height: 30px;
padding-left: 15px;
}
#inner ul {
padding: 10px 10px 2px 15px;
list-style: none;
}
#inner li {
margin-left: 10px;
margin-right: 10px;
line-height: 30px;
padding-left: 15px;
border-bottom: 1px dashed #BDBDBD;
background: url(images/img04.jpg) no-repeat left 50%;
}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
使用id来区分两者 例如,HTML将是:
<ul id="outter">
<li>The Outter List</li>
<li>More Outter List
<ul id="inner">
<li>This is the inner list</li>
<li><a href="#">Company Profile</a></li>
<li><a href="#">Enquiry</a></li>
<li><a href="#">Career</a></li>
<li><a href="#">Location Map</a></li>
</ul>
</li>
<li>Still The Outter</li>
</ul>
这看起来像这样:
#outter ul {
padding: 10px 10px 2px 0;
list-style: none;
}
#outter li {
margin-left: 10px;
line-height: 30px;
padding-left: 15px;
}
#inner ul {
padding: 10px 10px 2px 15px;
list-style: none;
}
#inner li {
margin-left: 10px;
margin-right: 10px;
line-height: 30px;
padding-left: 15px;
border-bottom: 1px dashed #BDBDBD;
background: url(images/img04.jpg) no-repeat left 50%;
}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
要减少内部列表上方的空间量,请更改ul的填充,使其为0或负值 例如:
ul {
padding: 0 10px 2px 0;
margin: 0px;
list-style: none;
}
您还可以使用特殊的样式表来纠正Internet Explorer中的问题,方法如下:
#outter ul {
padding: 10px 10px 2px 0;
list-style: none;
}
#outter li {
margin-left: 10px;
line-height: 30px;
padding-left: 15px;
}
#inner ul {
padding: 10px 10px 2px 15px;
list-style: none;
}
#inner li {
margin-left: 10px;
margin-right: 10px;
line-height: 30px;
padding-left: 15px;
border-bottom: 1px dashed #BDBDBD;
background: url(images/img04.jpg) no-repeat left 50%;
}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
然后,您需要另一个名为iespecific.CSS的CSS文件,其中包含上述ul样式。要减少内部列表上方的空间量,请更改ul的填充,使其为0或负值 例如:
ul {
padding: 0 10px 2px 0;
margin: 0px;
list-style: none;
}
您还可以使用特殊的样式表来纠正Internet Explorer中的问题,方法如下:
#outter ul {
padding: 10px 10px 2px 0;
list-style: none;
}
#outter li {
margin-left: 10px;
line-height: 30px;
padding-left: 15px;
}
#inner ul {
padding: 10px 10px 2px 15px;
list-style: none;
}
#inner li {
margin-left: 10px;
margin-right: 10px;
line-height: 30px;
padding-left: 15px;
border-bottom: 1px dashed #BDBDBD;
background: url(images/img04.jpg) no-repeat left 50%;
}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
然后,您需要另一个名为iespecific.CSS的CSS文件,其中包含上述ul样式。@Josh,谢谢,但问题是我在菜单顶部获得了更多空间。我也调整了填充物,但它仍然在顶部显示出更多的空间。如何删除菜单顶部的空白。您必须减小填充或边距的大小。你甚至可能需要一个负数。但是如果没有你的问题图片,我无法告诉你更多。在firefox中,它在菜单顶部显示的空间更少,但在explorer中,它在菜单顶部显示的空间更多。如何删除菜单顶部的空格。Please@Josh,谢谢,但问题是我在菜单顶部有更多的空间。我也调整了填充物,但它仍然在顶部显示出更多的空间。如何删除菜单顶部的空白。您必须减小填充或边距的大小。你甚至可能需要一个负数。但是如果没有你的问题图片,我无法告诉你更多。在firefox中,它在菜单顶部显示的空间更少,但在explorer中,它在菜单顶部显示的空间更多。如何删除菜单顶部的空格。请