Jump to content

How Do You Center A Form?


niche

Recommended Posts

How do I center this form so it stays centered when I adjust the size of my browser window?

<form>  First name:  <input type="text" name="firstname" />  <br />  Last name:  <input type="text" name="lastname" /></form> 

Thank-you.

Link to comment
Share on other sites

No it's not and there's no real context. I'm just trying to decide how to center this example I thought about using the align attribute in the div tag, but it's depreciated. How would you center this form?

<form>First name:<input type="text" name="firstname" /><br />Last name:<input type="text" name="lastname" /></form> 

Thanks.

Link to comment
Share on other sites

well, that's why I was asking if it is was in a div. I think centering something requires something relative to center it too. So, is it in a div? What is it in? Putting it in some sort of container and then applying those centering styles to it might work.

Link to comment
Share on other sites

Here's what I did and it works. I didn't think the CSS property, text-align, would work on a form in a div tag! Thanks for your help.

<style type="text/css">  div {text-align:right}</style><div>   <table  cellpadding="5">    <form>      First name:      <input type="text" name="firstname" />      <br />      Last name:      <input type="text" name="lastname" />    </form>   </table></div>

Link to comment
Share on other sites

  • 2 weeks later...
if your not using css it is fine to use. if he was using css i would have only said the css way.
If you're using it on a home or office intranet and using browsers that support it, it's fine to use.The point roundcorners is trying to make is that it won't be standards compliant and therefore may not work on some users browsers.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...