我正在使用asp.net菜单并且正常工作,除了最后一个子菜单的方向不会从左到右改变,子菜单的内容隐藏在屏幕边缘之后。
我的主页代码
<style type="text/css">
html, body {
height: 100%; /* Sets the body to fill the whole screen */
width: 100%;
overflow-x: hidden;
}
#button1 :hover {
background-color: black;
color: White;
}
#button2 {
color: white;
background: red;
}
.shadBrd1 {
background: url( '../Images/en-us/SiteShad1.gif' ) repeat-y right 50%;
}
.shadBrd2 {
background: url( '../Images/en-us/SiteShad2.gif' ) repeat-y left 50%;
text-align: left;
}
.ftrArea {
background: #c8c8c8 url( '../Images/ftrBg.gif' ) repeat-X right top;
margin-top: 10px;
height: 29px;
width: 74%;
text-align: center;
bottom: 0px;
}
.mainTbl {
margin-left: auto;
margin-right: auto;
width: 955px;
border-collapse: collapse;
margin-top: 0px;
margin-bottom: 0px;
bottom: 0px;
height: 100%;
}
.bodyhd {
text-align: center;
margin-bottom: 2px;
margin-top: 0px;
}
#form1 {
height: 100%;
}
#form2 {
height: 229px;
width: 974px;
margin-bottom: 0px;
}
a:link {
text-decoration: none;
font-size: ١٠px;
font-family: Tahoma;
color: #595959;
border: 0px;
}
.style8 {
}
.style9 {
height: 132px;
}
.style10 {
font-size: smaller;
height: 75%;
direction: rtl;
bottom: 0px;
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
.style11 {
height: 29px;
text-align: center;
bottom: 0px;
margin-top: 10px;
margin-bottom: 0px;
background: #c8c8c8 url('../Images/ftrBg.gif') repeat-X right top;
}
.style12 {
}
.style14 {
color: #CC3300;
font-size: 11px;
font-family: Verdana;
}
.copyR {
font-family: Verdana;
font-size: x-small;
font-weight: 700;
}
#Progress_bar {
position: absolute;
left: 40%;
top: 50%;
margin-top: -30px; /* make this half your image/element height */
margin-left: -30px; /* make this half your image/element width */
color: #CC3300;
}
</style>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true"></asp:ToolkitScriptManager>
<div style="height: 100%;">
<table class="mainTbl" style="width: 1000px; text-align: right; height: 100%;" align="center"
cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="White" rowspan="8" valign="top" class="shadBrd2">
<img alt="" src="../Images/en-us/SiteShad2.gif" style="width: 20px; height: 26px" />
</td>
<td style="text-align: left" class="style8" colspan="2"></td>
<td bgcolor="White" rowspan="8" valign="top" class="shadBrd1">
<img alt="" src="../Images/en-us/SiteShad1.gif" style="width: 20px; height: 26px" />
</td>
</tr>
<tr>
<td style="text-align: right" class="style12">
</td>
<td style="text-align: left">
<strong><span class="style14"></span>
</strong>
</td>
</tr>
<tr>
<td class="style9" colspan="2">
<img alt="" src="../Images/header_img.jpg" style="width: 1000px;" />
</td>
</tr>
<tr>
<td id="div_Menu" bgcolor="#1C5E55" class="style8" colspan="2" style="height: 25px;">
<div style="background-position: center;">
<asp:Menu ID="NavigationMenu" CssClass="menu" DynamicHorizontalOffset="1" StaticSubMenuIndent="1px"
DataSourceID="MenuSource" MaximumDynamicDisplayLevels="4" Orientation="Horizontal"
runat="server" StaticDisplayLevels="2" Font-Bold="True" Font-Overline="False"
StaticEnableDefaultPopOutImage="true" IncludeStyleBlock="false" ItemWrap="True"
RenderingMode="List" StaticPopOutImageUrl="../Images/down.gif"
OnMenuItemDataBound="NavigationMenu_MenuItemDataBound"
>
</asp:Menu>
<asp:SiteMapDataSource ID="MenuSource" runat="server" ShowStartingNode="true" StartFromCurrentNode="false" />
</div>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr class="bodyhd" valign="top">
<td class="style10" colspan="2">
<asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server">
</asp:ContentPlaceHolder>
<div style="background-color: #1C5E55; font-size: large; color: White">
<asp:UpdateProgress ID="MainProgress" DisplayAfter="1" runat="server">
<ProgressTemplate>
<div id="ProgressDiv">
يرجى الانتظار للتحميل....
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</td>
</tr>
<tr>
<td class="style11" colspan="2">
<asp:Label ID="lblCopyright" runat="server" meta:resourcekey="lblCopyrightResource1"
CssClass="copyR"> </asp:Label>
</td>
</tr>
</table>
</div>
</form>
我使用过“overflow-x:hidden;”在html中,正文用左侧的水平滚动条隐藏不必要的空白区域。在此之前,当我向左滚动时子菜单可见,但滚动条的空间永远不会结束。它的持续时间非常长。
我的图片链接在这里 http://i59.tinypic.com/2zqdiy1.jpg
我没有声誉所以它不允许我在这里发布图片。
My Menu Code is like this
<tr>
<td id="div_Menu" bgcolor="#1C5E55" class="style8" colspan="2" style="height: 25px;">
<div style="background-position: center;">
<asp:Menu ID="NavigationMenu" CssClass="menu" DynamicHorizontalOffset="1" StaticSubMenuIndent="1px"
DataSourceID="MenuSource" MaximumDynamicDisplayLevels="4" Orientation="Horizontal"
runat="server" StaticDisplayLevels="2" Font-Bold="True" Font-Overline="False"
StaticEnableDefaultPopOutImage="true" IncludeStyleBlock="false" ItemWrap="True"
RenderingMode="List" StaticPopOutImageUrl="../Images/down.gif"
OnMenuItemDataBound="NavigationMenu_MenuItemDataBound"
>
</asp:Menu>
<asp:SiteMapDataSource ID="MenuSource" runat="server" ShowStartingNode="true" StartFromCurrentNode="false" />
</div>
</td>
</tr>
和css
div.menu {
background-color: #1C5E55;
}
/* To avoid flickering of asp.ne menu A52A2A*/
/* *************************/
div.menu > ul > li {
display: inline-block;
list-style: none;
}
div.menu ul li ul {
display: none;
}
/* *************************/
div.menu ul {
background-color: #1C5E55;
list-style: none;
margin: 0px;
padding: 0px;
width: auto;
font-size: 14px;
font-family: Arial, Verdana;
font-weight: 600;
z-index: 999;
}
div.menu ul li a, div.menu ul li a:visited {
/*background-color: #5c5c5c;*/
border-bottom: 1px #5c5c5c solid;
color: white;
display: block;
line-height: 1.35em;
padding: 4px 20px;
text-decoration: none;
white-space: nowrap;
}
div.menu ul.level1 {
border-bottom: 0;
}
div.menu ul li a:hover {
/* background-color: #bfcbd6; color: #465c71;*/
background-color: #84BF99;
color: #FFFFFF;
text-decoration: none;
}
div.menu ul li a:active {
background-color: #465c71;
color: #cfdbe6;
text-decoration: none;
}
div.menu ul li a {
display: block;
padding: 0 20px;
margin: 0px 0;
line-height: 35px;
line-height: 2em;
text-decoration: none;
border-right: 1px solid Gray;
}
ul > li:first-child a {
border: none;
}
div.menu ul li a.level1 {
border-bottom: none;
}
div.menu ul li a.level2 {
border-bottom: none;
}
div.menu ul li a[title] {
border-bottom: none;
}
/* to manipulate dropped menu*/
div.menu ul li ul li a
{
font-size: 16px;
font-family: Arial, Verdana;
font-weight: 600;
}
请帮帮我。我很震惊。
我在这里问了同样的问题 http://forums.asp.net/t/2037911.aspx?Asp+net+menu+submenu+problem但我没有得到任何答案。
答案 0 :(得分:0)
我通过将这些行添加到导航菜单css
来解决ul:first-child&gt; li:last-child ul.level4 { 保证金右:-300px }