简体   繁体   中英

How to set simple form alignment style in web2py?

I am using simple form in web2py. In controller I create a form like this:

form=FORM(DIV(INPUT(_id='itemId',_name='itemId',_value='102737069',requires=[IS_NOT_EMPTY("please input correct itemId"),IS_LENGTH(maxsize=12)]), INPUT(_type='submit',_value='search_key',_name='search'), INPUT(_type='submit',_value="random_key",_name='random')))    

In corresponding html the form is embedded in a div tag and I want the form align to center. How to set it? Thanks.

EDIT: This is the html code. Now I can only use two
to align the form to center approximately. I am new in css.

<div class="top">
<div class="header_left">
      <div class="msg">
         please submit the itemId...
      </div>
   </div>
   <div class="header_right">
<br/><br/>
{{=form}}
</div>
</div>
<br/>
<br/>
<br/>

In the beginning div tag that the form is in, add align="center" .

So if I'm understanding your issue correctly then you'll want to put align="center" in the <div class="header_right"> like found in this jsfiddle .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM