1

http://jsfiddle.net/msbyuva/QPQqs/

li Menu Links Hi I have a menu formed using

<ul class="topnav">
                            <li>@Html.ActionLink("Configuration", "Configuration", "Home")</li>
                            <li>@Html.ActionLink("Reporting", "Reporting", "Home")
                            <ul class="subnav">
                    <li>@Html.ActionLink("Pipeline", "Pipeline", "Pipeline", null, new { target = "_blank", Url = "http://storespipeline/stores/" })</li>
                            <li>D2C OBI Reports</li>                  


                          <li>@Html.ActionLink("Device Utilization", "DeviceUtilization", "DeviceUtilization")</li>

                            <li>@Html.ActionLink("Display Audit", "DisplayAudit", "DisplayAudit")</li>
                            <li>@Html.ActionLink("TrueVUE Reports", "TrueVUE", "TrueVUE")</li>                                 
                            </ul>
                            </li>
                            <li>@Html.ActionLink("Admin", "Admin", "Home")</li>
                    </ul>

CSS:

ul.topnav { list-style: none; padding: 10px; margin: 0; float: left; width: 100%; background: #f6f6f6; font-size: 1em; color: Black; } ul.topnav li { float: left; margin: 0; padding: 0 15px 0 0; position: relative; } ul.topnav li a { padding: 5px 0px 0px 0px; color: black; display: table; text-decoration: none; float: left; } ul.topnav li a:hover { text-decoration: underline; font-weight: bold; }

    ul.topnav li span.subhover
    {
    }
    ul.topnav li ul.subnav
    {
        list-style: none;
        position: absolute;
        left: 0px;
        top: 25px;
        background: #f6f6f6;
        margin: 0;
        padding: 0px 0px 0px 0px;
        height: auto;
        display: none;
        float: left;
        min-width: 100px;
        width: auto;
    }
    ul.topnav li ul.subnav li
    {
        margin: 0px;
        padding: 4px 10px 0px 10px;
        height: auto;
        line-height: 100%;
    }

    html ul.topnav li ul.subnav li a
    {
        float: left;
        width: 150%;
        margin: 0px;
        padding: 0px 0px 0px 0px;
        text-align: left;
    }

    html ul.topnav li ul.subnav li a:hover
    {

    }
</style>

When I click on a link example -- Display Audit -- when the page gets loaded -- the menu link is underneath the page content... that can be seen in the image (the last two links go underneath the page content)..... how can I display the menu link above the page content??

I am using IE7, CSS 2.1

3
  • Where is the CSS part? could you provide a fiddle? Aug 28, 2013 at 19:35
  • could you provide a fiddle? Aug 28, 2013 at 19:35
  • I updated the question part with css and html code.... here is the link for fiddle jsfiddle.net/msbyuva/QPQqs
    – msbyuva
    Aug 28, 2013 at 19:53

1 Answer 1

4

You need to use a z-index. For z-index to work both the navigation container and the content container need to have a position of relative, absolute or fixed. For your example I would suggest a relative positioning.

.topnav {
  position:relative;
  z-index:1000;
}

.yourContentContainer{
  position:relative;
  z-index:1;
}
1
  • You may need to use seeral different positions, like relative or fixed for the menu, and absolute for the content/reports, as I have noticed that two relatively positioned divs occasionaly interact. For example, your dropdown menu may actually force the report to shift to a position further down the page, which looks ugly and is really annoying. Be sure to check multiple browsers too, some may compute the relationship between the divs inconsistently. Aug 28, 2013 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.