Anand
Anand

Reputation: 10400

How to position an input form at the center of a page?

I want to position a registration from at the center of a page.

please tell me how should i do that

Upvotes: 8

Views: 55637

Answers (3)

user2395366
user2395366

Reputation: 31

Just use:

<div style="margin:0 auto" align=center>
 <input button>
</div>

Upvotes: 3

Michael Holland
Michael Holland

Reputation: 11

I created a .CSS file with the following:

form {width: 40%;
      margin-right: 30%;
      margin-left: 30%;
      background-color: green}

div.mainform {width:100%;
              border:1px solid #000}

Then in the HTML document I used.

<DIV ID="MAINFORM">
    <FORM>
        Other HTML Markup
    </FORM>
</DIV>

Upvotes: 1

Wayne Hartman
Wayne Hartman

Reputation: 18487

Encapsulate it in a div with the following CSS attributes:

<div style="width:400px; margin-right:auto; margin-left:auto; border:1px solid #000;">
    <form action="helloWorld">
        <Some markup>
    </form>
</div>

Upvotes: 11

Related Questions