views:

660

answers:

1

The default code shows the Home menu item aligned to the right. I changed the ul:menu and added attribute float:left to get the 'Home' menu too be aligned to the left of the page but to no avail.

Is there way to show the 'home' menu to be on the left end of the page. I am trying to create a menu bar similar to SO as a learning project

+2  A: 

its a CSS issue but in site.css you can make following changes:

#menucontainer
{
    margin-top:40px;
    clear: both; /* Add this*/
}

and also

ul#menu
{
    border-bottom: 1px #5C87B2 solid;
    padding: 0 0 2px;
    position: relative;
    margin: 0;
    text-align: left; /* Change from right to left */
}

Work for this Site.Master

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <asp:ContentPlaceHolder ID="head" runat="server">
        <title></title>
    </asp:ContentPlaceHolder>
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <div class="page">
        <div id="header">
            <div id="title">
                <h1>My MVC Application</h1>
            </div>
            <div id="logindisplay">
                <% Html.RenderPartial("LogOnUserControl"); %>
            </div> 
            <div id="menucontainer">
                <ul id="menu">              
                    <li><%= Html.ActionLink("Home", "Index", "Home")%></li>
                    <li><%= Html.ActionLink("About", "About", "Home")%></li>
                </ul>
            </div>
        </div>
        <div id="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server" />
            <div id="footer">
            </div>
        </div>
    </div>
</body>
</html>
Claus Thomsen
Claus:This is my site.css#menucontainer{ margin-top:40px; }ul#menu{ border-bottom: 1px #5C87B2 solid; padding: 0 0 2px; position: relative; margin: 0; text-align:left; }The menu items still align right
the "clear: both;" is the key
Claus Thomsen
Claus, I may be blind here. i did exactly what you specified. in site.master i have<div class="page"><div id="header"><div id="menucontainer"><ul id="menu"><li><%=Html.ActionLink("Home","Index","Home") %></li>Still a no show