简体   繁体   中英

WTForms Label Position / Hiding Label

I've build a form using HTML / CSS with Bootstrap and I'm trying to integrate WTForms into it - everything was working fine and formatting perfectly until I started formatting the fields using wtf.form_field function and now I seem to have excess labels.

Can anyone tell me how to a) reposition the labels or b) do not render them at all?

Here's a sample of my code:

<div class="container">
    <form action="" method="post" novalidate>
    <div class="form-group row">
        <label for="label-name" class="col-sm-4 col-form-label">Desired Label Position</label>
        <div class="col-sm-8">
 {{ wtf.form_field(form.crm_description, class="form-control", placeholder="Placeholder Text", rows="1", readonly=true)}}

         </div>
     </div>

And here's an example of what I'm trying to achieve: 字段位置示例 The label on the left side is by design, however wtforms seems to want to add it's own label on the top of the field itself that I can't seem to move.

thanks

look at the the class and set the css label display to none

for example:

 <style> label{ display: None; } </style>

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