css - 防止子元素使用父类

标签 css inheritance parent-child

我遇到了这种情况的问题,我有一个带有一个全局类的小表单,我用它来跟踪表单的状态,但现在我有一个复选框,我不想继承那个父类。 .. 那么如何防止呢?

<div id="find_employee" class="myCustomClass">
<div class="col-lg-3">
            <div class="form-group">
                <label for="employee_last_name">Last Name</label>
                <input id="employee_last_name" name="employee_last_name" type="text" maxlength="30" class="form-control filterItem" placeholder="Last Name">
            </div>
        </div>
        <div class="col-lg-3">
            <div class="form-group">
                <label for="employee_first_name">First Name</label>
                <input id="employee_first_name" name="employee_first_name" type="text" maxlength="30" class="form-control filterItem" placeholder="First Name">
            </div>
        </div>
        <div class="col-lg-3">
            <div class="form-group">
                <label for="employeeID">Employee ID #</label>
                <input id="employeeID" name="employeeID" type="text" maxlength="10" class="form-control filterItem" placeholder="Employee ID #">
            </div>
        </div>
<div class="col-lg-12">
            <div class="form-group">
                <input type="checkbox" name="isActiveEmployee" id="isActiveEmployee" value="false" />
                <label for="isActiveEmployee">Include Inactive Employee</label>
            </div>
</div>

如何在底部的复选框元素上禁用 myCustomClass?通过 js、jquery 或 css?

最佳答案

将 myCheckboxClass 添加到复选框,然后在 myCustomClass 上使用非选择器

myCustomClass: not(.mycheckboxClass) { ... }

关于css - 防止子元素使用父类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52440956/

相关文章:

c# - 如何消除接口(interface)之间的重复

r - 将父子关系转化为带有属性的树

javascript - 视差动画滚动效果

css - 在div的特定高度显示完整图像

C++ 内联基类方法必须显式解析?

mysql - 删除 MySQL 中的父表

javascript - 同时完成子进程和 Promise 决议

javascript - 如何在关闭阅读更多/关闭面板时停止音频播放器。

html - CSS 菜单悬停一个子元素并同时更改所有其他元素

inheritance - golang中定义接口(interface)时如何思考?