开发者

How to horizontally center a form accross a page?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜