Solved

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

Posted on 2015-01-11
4
122 Views
Last Modified: 2015-01-11
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

0
Comment
Question by:penlandt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40543758
this should do it:

.MPLoginView{
    float: right;  
}
0
 
LVL 1

Author Comment

by:penlandt
ID: 40543787
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
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
ID: 40543797
this is because the header does not "spread" to the page width...


header{
    display:inline-block;
    width: 100%;
}
0
 
LVL 1

Author Closing Comment

by:penlandt
ID: 40543817
Thank you very much...that did the trick!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question