开发者

How to horizontally center a form accross a page?

开发者 https://www.devze.com 2023-04-10 11:15 出处:网络
I have an HTML doc that looks roughly like this: <html> <head><title>Example</title></head>

I have an HTML doc that looks roughly like this:

<html>
  <head><title>Example</title></head>
  <body>
     <div id="main_content" style="width:90%;">
         <form id="searchbox" method="post" action="#">
             <input type="text" name="search" />
             <开发者_StackOverflow社区;input type="submit />
         </form>
     </div>
  </body>
</html>

How do I (horizontally) center the search form in the page?


Using CSS:

  • assign it a width
  • use margin-left:auto, margin-right:auto
0

精彩评论

暂无评论...
验证码 换一张
取 消