简体   繁体   English

TYPO3表单-复选框的Bootstrap样式

[英]TYPO3 form - Bootstrap styling of checkboxes

Is there a ready to use css snippet to style the checkboxes created with TYPO3 extension form ( https://docs.typo3.org/typo3cms/extensions/form/8.7/ )? 是否可以使用css片段来设置使用TYPO3扩展名表单( https://docs.typo3.org/typo3cms/extensions/form/8.7/ )创建的复选框的样式? The html of the form checkbox element looks like this: 表单复选框元素的html如下所示:

html: 的HTML:

<div class="form-group">
    <div class="input checkbox">
        <div class="form-check">
            <label class="add-on form-check-label" for="basicContactForm-checkbox-1">
            <input name="tx_form_formframework[BasicContactForm][checkbox-1]" value="" type="hidden">
            <input required="required" class="add-on" id="basicContactForm-checkbox-1" name="tx_form_formframework[BasicContactForm][checkbox-1]" value="1" type="checkbox">
            <span>Yes, I confirm!<span class="required">*</span></span>
            </label>
        </div>
    </div>
</div>

And I would like to style it sth similar like eg Awesome Bootstrap Checkbox: 我想将其样式设置为类似Awesome Bootstrap Checkbox:

https://www.cssscript.com/demo/pretty-checkbox-radio-inputs-with-bootstrap-and-awesome-bootstrap-checkbox-css/ https://www.cssscript.com/demo/pretty-checkbox-radio-inputs-with-bootstrap-and-awesome-bootstrap-checkbox-css/

What's the best way to accomplish this? 做到这一点的最佳方法是什么?

something like this will work 这样的事情会起作用

added a span to your html- see the note below the rest is just css - I hope this helps you out 为您的html添加了一个跨度-看到下面的注释只是CSS-我希望这对您有所帮助

if you cant add any html and it has to be straight css then this fiddle will work(best i can do on the fly). 如果您不能添加任何HTML,并且它必须是直的CSS,那么此提琴将起作用(最好是我可以即时执行)。 expanding on this css should do the trick 扩展此CSS应该可以解决问题

 .form-check { display: block; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 22px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .form-check input { position: absolute; opacity: 0; cursor: pointer; } .checkmark { position: absolute; top: 0; left: 0; height: 20px; width: 20px; background-color: #eee; border: 1px solid #e3e4e5; } .form-check input:checked ~ .checkmark { background-color: purple; } .checkmark:after { content: ""; position: absolute; display: none; } .form-check input:checked ~ .checkmark:after { display: block; } .form-check .checkmark:after { left: 7px; top: 3px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg } 
 <div class="form-group"> <div class="input checkbox"> <div class="form-check"> <label class="add-on form-check-label" for="basicContactForm-checkbox-1"> <input name="tx_form_formframework[BasicContactForm][checkbox-1]" value="" type="hidden"> <input required="required" class="add-on" id="basicContactForm-checkbox-1" name="tx_form_formframework[BasicContactForm][checkbox-1]" value="1" type="checkbox"> <span class="checkmark"></span><!-- added for checkbox --> <span>Yes, I confirm!<span class="required">*</span></span> </label> </div> </div> </div> 

只需将CSS添加到您的头部并按照github https://github.com/flatlogic/awesome-bootstrap-checkbox上的文档操作即可

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

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