Link to home
Start Free TrialLog in
Avatar of Todd Penland
Todd PenlandFlag for United States of America

asked on

How to style header element so that logo is fixed at the left and login status fixed at the right

I need to do something similar to what Experts Exchange has done with its header.  My logo is floated to the left of the header and the profile link is fixed at the right of the same element.

I'm including my HTML and CSS for the elements involved in this.  The element that I need to fix in the upper right of the header element is in the div called MPLoginView.  I've tried floating the logo left and MPLoginView right but this doesn't seem to work.  Can someone help explain how I should do this?  Thanks!

HTML
        <div id ="PageWrapper">
            <header>
                <div class="MPLogo">LOGO IMAGE GOES HERE</div>
                <div class="MPLoginView">
                    <asp:LoginView runat="server">
                        <AnonymousTemplate>
                            <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Register.aspx">Register</asp:HyperLink>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Login.aspx">Login</asp:HyperLink>
                        </AnonymousTemplate>
                        <LoggedInTemplate>
                            Logged in as <asp:LoginName runat="server" /> | <asp:LoginStatus runat="server" />
                        </LoggedInTemplate>
                    </asp:LoginView>
                </div>
            </header>
            ...
       </div>

Open in new window


CSS
body {
    background-image:url("/Images/CalendarBG.jpg");
    font-family:Verdana, Geneva, Tahoma, sans-serif;
    font-size:small;
    padding:0% 10% 0% 10%;
}

header{
    display:inline-block;
}

.MPLogo{
    float:left;
}

.MPLoginView{
    
}

#PageWrapper {
    background-color:white;
    padding:10px;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Todd Penland

ASKER

Unfortunately it doesn't (I mentioned that I tried that in the original post).  I thought it should work too but it positions .MPLoginView right next to the logo rather than to the right of the header element (see attached screenshot).
Capture.PNG
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much...that did the trick!