开发者

Want to use form and styling option together

I'm shifting an application from cgi to web.py. I want to use the web.form. However I've noticed that it creates a table on its own. Is it possible 开发者_C百科to style the created table (width, height, etc...)??? If yes, how???


The table is the result of form rendering, so naturally it’s placed within a form element. In my case it looks like this in the login.html template:

<form name="main" method="post" class="login"> 
$if not form.valid: 
    <p class="wrong">Login incorrect.</p>
$:form.render()
</form> 

In the browser, when rendered, the form looks like this:

<form name="main" method="post" class="login"> 
<table> 
    <tr><th><label for="login">login</label></th><td><input type="text" id="login" name="login"/></td></tr> 
    <tr><th><label for="password">password</label></th><td><input type="password" id="password" name="password"/></td></tr> 
    <tr><th><label for="Login"></label></th><td><button id="Login" name="Login">Login</button></td></tr> 
</table> 
</form> 

So you can apply arbitrary styling, including positioning, to this table using the following CSS:

form.login table { /* your styling */ }    
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜