0

alignment fail

I'd like to align these so that the login and signup are vertically aligned with the center of the braces, and that everything (except the input boxes/labels) is horizontal across the screen.

Here is my HTML:

 <body>
<img src="{{ STATIC_URL}}logo.png" class='center'></br>
<div style:"display:inline;">
    <a href='#' title='click to login' onClick='login()'>login</a>
    <img src="{{ STATIC_URL}}leftParens.png" style:"display:inline">
    <form method='post' action='login' id='loginForm'>
    {% csrf_token %}
        <label for="username">username</label>
        <input name="username" type="text" id="username" face="helvetica"/>
        </br>
        <label for="password">password</label>
        <input name="password" type="password" id="password" face="AmericanTypewriter"/>
    </form>
    <img src="{{ STATIC_URL}}rightParens.png" style:"display:inline">
    <a title='signup for omnicloud' href='signup' class='login_signup_button'>signup</a>
</div>
</body>

And the corresponding CSS:

@font-face{
    font-family:AmericanTypewriter;
    src:url('AmericanTypewriter.TTF');
}

body{
    background-color:rgb(71,103,255);
    text-align:center;
}

img.center{
    margin-left: auto;
    margin-right: auto;
    width:500px;
}

    /* Used for braces */
form,fieldset,h1,h2,a,label{
    margin:0;
    padding:0;
    font:30px/32px normal 'AmericanTypewriter', courier, sans-serif;
    color:#fff;
    display:inline;
}

a{
    vertical-align: 50%;
}

input{
     margin:0;
   padding:0;
   font:20px/22px normal 'AmericanTypewriter', courier, sans-serif;
   color:rgb(48,94,255);
}

    /* Used for login, signup, username, password */
#loginForm{
   display:block;
   margin:50px auto;
   height:100px;
}

The goal: enter image description here

1 Answer 1

1

To begin with, I would rework your HTML to be arranged into boxes. For instance, I would put your <a href> for the login link and the corresponding <img> into a separate div; and do the same for the signup <a href> and <img>. Putting these tags into their own boxes would then allow you to absolutely position the login link, and move the login link to where you want it, inside the confines of the containing div. Not sure how you want the rest of your page positioned, can you clarify?

Sign up to request clarification or add additional context in comments.

2 Comments

Oh that's a great idea! I've put a screenshot into the question to show you a mockup for what I'm going for
Perfect! Thanks. So, after you have created your signup and login divs, I would put those divs in a <div id="content"> along with your <form>, and once again use absolute positioning to maneuver your parentheses divs into position within #content. Does that help?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.