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
116 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 142

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 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Entity Framework 3 46
Host asp.net pages 5 25
Angular JS Route 3 45
IIS Express Working in one Visual Studio Solution, but not in another. Why? 2 14
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…
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now