[英]TYPO3 form - Bootstrap styling of checkboxes
是否可以使用css片段來設置使用TYPO3擴展名表單( https://docs.typo3.org/typo3cms/extensions/form/8.7/ )創建的復選框的樣式? 表單復選框元素的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>
我想將其樣式設置為類似Awesome Bootstrap Checkbox:
做到這一點的最佳方法是什么?
這樣的事情會起作用
為您的html添加了一個跨度-看到下面的注釋只是CSS-我希望這對您有所幫助
如果您不能添加任何HTML,並且它必須是直的CSS,那么此提琴將起作用(最好是我可以即時執行)。 擴展此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.