Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3220790
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:48:06+00:00 2026-05-17T15:48:06+00:00

I have the following code <div id=header class=row> <ul id=topnav> <li> <a href=#>a</a> <span><a

  • 0

I have the following code

<div id="header" class="row">
    <ul id="topnav">
        <li>
            <a href="#">a</a>
            <span><a href="#">aa</a> <a href="#">ab</a></span>            
        </li>
        <li>
            <a href="#">b</a>
            <span><a href="#">ba</a> <a href="#">bb</a></span>
        </li>
        <li style="float: right;"><a href="#">Login</a></li>
    </ul>

    <div id="login_container">
        <form method="post" id="login_form">
            <table>login form</table>
        </form>

        <form method="post" id="create_account_form">
            <table>create account form</table>
        </form>
    </div>    
</div>

<div id="content">
content here
</div>

The header is about 60px tall and 960px wide, centered in the browser window and sticking to the top of the viewport. When the user clicks on “Login” the #login_container reveals itself. However, I want to position it aligned right with the header row, not aligned to the right of the viewport. I can do that by not using ‘position: absolute’ when styling #login_container, however, then the login form gets cut-off because the containing #header div is not tall enough. In other words, I want the #login_container aligned with the right edge of #header, but laid on top of #content, if any.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:48:07+00:00Added an answer on May 17, 2026 at 3:48 pm

    You could either set

    #header {
     position: relative;
     height: 60px;
    }
    #login_container {
     position: absolute;
     right: 0;
     top: 60px; /* equal to #header height, if it's not fixed, you should retrieve it dynamically via jQuery */
    }
    

    and then dynamically retrieve #content’s size and apply it to #login_container.

    Otherwise, and maybe even better, you could wrap the whole code in a #container div, set its width to whatever width you wish the site to have, set it centered, then move #login_container from inside #header to immediately after it and with absolute position. You will have a cleaner css code and less meddling to do with jQuery (just setting login_container’s height).. so it should be like this (if I’m not missing anything):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    <style type="text/css">
    * {
        margin: 0;
        padding: 0;
    }
    #container {
        width: 960px;
        margin: 0 auto;
        position: relative;
    }
    #login_container { 
        position: absolute; 
        right: 0;
        width: 100%;
        z-index: 10;
    }
    #content {
        position: relative;
        z-index: 0;
    }
    </style>
    <!--[if lte IE 6]><style type="text/css"></style><![endif]-->
    </head>
    
    <body>
    <div id="container">
        <div id="header" class="row">
            <ul id="topnav">
                <li>
                    <a href="#">a</a>
                    <span><a href="#">aa</a> <a href="#">ab</a></span>            
                </li>
                <li>
                    <a href="#">b</a>
                    <span><a href="#">ba</a> <a href="#">bb</a></span>
                </li>
                <li style="float: right;"><a href="#">Login</a></li>
            </ul>
    
        </div>
        <div id="login_container">
            <form method="post" id="login_form">
                <p>login form</p>
            </form>
    
            <form method="post" id="create_account_form">
                <p>create account form</p>
            </form>
        </div>    
    
        <div id="content">
        content here
        </div>
    </div>
    </body>
    </html>
    

    Give it a try and let me know if you still got problems!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code in html : <div id=header> <div id=logo></div> <div id=versione>
I have the following code: <ul class=cssdropdown> <li class=headlink>RANGE <ul class=innerDrop> <li>Range Child</li> <ul>
'<div id="'+div_id+'" class="widget" style="height:60px;width:110px">\n\ <div class="widget-head ui-widget-header" style="cursor:move;height:20px;width:130px">'+ '<span id="'+span_id+'" style="float:right; cursor:pointer" class="dialog_link ui-icon
I have the following code to generate a blank html page with a series
Hi I've just started couple of days ago with codeigniter, I have a following
The following code is given by one of user and friend on stackoverflow as
I use the following code to find a particular table, hide it then show
What I want is to do something like this in my views: <% page_header
Calling the ajax called URL works well without ajax eg. http://localhost/ci/controller/method/param_value . But using
anyone know how to stop a .hover happening again before the mouseout animation has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.