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
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
119 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
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Help in good tutorials for PHP, HTML and CSS 6 41
exporting html table data 4 28
Media Queries  not Firing 6 19
Code works but breaks when I add one section 4 20
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

828 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