【问题标题】:TYPO3 form - Bootstrap styling of checkboxesTYPO3 表单 - 复选框的引导样式
【发布时间】:2018-05-16 16:36:45
【问题描述】:

是否有准备好使用 css sn-p 来设置使用 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>

我想将它的样式设置为类似的,例如很棒的引导复选框:

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

最好的方法是什么?

【问题讨论】:

    标签: css twitter-bootstrap-3 typo3 typo3-8.x typo3-extensions


    【解决方案1】:

    这样的事情会起作用

    在您的 html 中添加了一个跨度 - 请参阅下面的注释 剩下的只是 css - 我希望这对你有所帮助

    如果你不能添加任何 html 并且它必须是直接的 css 那么这个fiddle 将工作(最好我可以在飞行中做)。扩展这个 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>

    【讨论】:

    【解决方案2】:

    只需将 CSS 添加到您的脑海中,然后按照 github 上的文档 https://github.com/flatlogic/awesome-bootstrap-checkbox

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 1970-01-01
    • 2015-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多