2

I am putting together a quick and dirty website using the asp.net 4.0 template in Visual Studio 2010.

My ISP only supports 3.5. When I convert from 4.0 to 3.5 the navigationmenu css screws up (ie the links just appear as normal links).

The code is just:

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                <Items>
                    <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                    <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
                </Items>
            </asp:Menu>

And the CSS is:

    div.hideSkiplink
{
    background-color:#dba201;
    width:100%;
}

div.menu
{
    padding: 4px 0px 4px 8px;
    color:Red;
}

div.menu ul
{
    list-style: none;
    margin: 0px;
    padding: 0px;
    width: auto;
}

div.menu ul li a, div.menu ul li a:visited
{

    color: #fff;
    display: block;
    line-height: 1.35em;
    padding: 0px 20px;
    text-decoration: none;
    white-space: nowrap;
}

div.menu ul li a:hover
{

    text-decoration: none;
    font-weight:bold;
}

div.menu ul li a:active
{
    font-weight:bold;
    text-decoration: none;
}

ie pretty much the default with a couple of minor tweaks.

Any idea why it doesn't render the css, and how I can fix it?!

4

1 回答 1

0

.Net 4.0 使用liul标签创建导航菜单。

我正在尝试调整 CSS,因为 .Net 3.0 使用divspan来创建导航菜单。

如果有人可以提供帮助。

生成的导航菜单:

<div class="clear hideSkiplink">
    <a href="#ctl00_ctl00_NavigationMenu_SkipLink" style="display:inline-block;height:1px;width:1px;">
        <img src="/WebResource.axd?d=96sED37vRbOG5ljhopJ0HzPIl0UI63LUPEUULLu3zBeOX7fZmKkMVsgvI2x7KFlcdPVEOKtFPANjh4h2WI8BNTK7p7o1&amp;t=634604353351482412" alt="Pular Links de Navega&ccedil;&atilde;o" style="border-width:0px;" />
    </a>
    <div id="ctl00_ctl00_NavigationMenu">
        <span>
            <a class="ctl00_ctl00_NavigationMenu_1" href="Home.aspx">Home</a>
        </span>
        <span>
            <a class="ctl00_ctl00_NavigationMenu_1" href="About.aspx">About</a>
        </span>
    </div>
    <a name="ctl00_ctl00_NavigationMenu_SkipLink"></a>
</div>
于 2012-05-21T15:23:05.660 回答