简体   繁体   English

如何在Prestashop上对齐复选框和标签

[英]How to align checkbox and label on prestashop

Hi, I'm working on a prestashop module, and I want to align a checkbox with a label in a smarty template. 嗨,我正在制作一个prestashop模块,我想将一个复选框与一个smarty模板中的标签对齐。

I try this for exemple : 我以这个为例:

<input id="Checkbox1" name="Checkbox1" type="checkbox" value="Admin" />
<label for="Checkbox1">test</label>

But on my navigator the label is under the checkbox, and in HTML source, I see a div around my checkbox . 但是在导航器上,标签位于复选框下方,并且在HTML源代码中,我在checkbox周围看到了一个div

<div class="checker" id="uniform-Checkbox1"><span><input id="Checkbox1" name="Checkbox1" value="Admin" type="checkbox"></span></div>
<label for="Checkbox1">test</label>

This code run perfectly in a classic HTML page. 此代码可在经典HTML页面中完美运行。 Thanks for help. 感谢帮助。 I use Prestashop 1.6.1.4 in a docker environment. 我在docker环境中使用Prestashop 1.6.1.4。

Paste following css in your custom css file: 将以下css粘贴到您的自定义css文件中:

.checker,
.checker+label {
  display: inline-block;
  vertical-align: middle;
}

 .checker, .checker+label { display: inline-block; vertical-align: middle; } 
 <div class="checker" id="uniform-Checkbox1"><span><input id="Checkbox1" name="Checkbox1" value="Admin" type="checkbox"></span></div> <label for="Checkbox1">test</label> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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