如何在CSS中选择此元素?

时间:2018-05-24 18:42:46

标签: css

如何在CSS中选择<button>list-group-item和状态disabled

<button class="list-group-item" disabled>...</button>
<button class="list-group-item">...</button>
是什么样的?
button.list-group-item:disabled

感谢。

2 个答案:

答案 0 :(得分:0)

您也可以使用属性选择器执行此操作:

&#13;
&#13;
int main(int argc, const char *argv[]) {
    std::vector<int> rw{1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1};
    std::mutex m;
    auto multithread_shuffle = [rw, &m]() mutable {
        unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
        std::shuffle (rw.begin(), rw.end(), std::default_random_engine(seed));
        std::lock_guard lock(m);
        for (size_t i = 0; i < rw.size(); i++) {
            std::cout << "rw[" << i << "] = " << rw[i] << std::endl;
        }
    };
    std::thread t1(multithread_shuffle);
    std::thread t2(multithread_shuffle);
    t1.join();
    t2.join();
    return 0;
}
&#13;
.list-group-item[disabled] {
  color:red;
}
&#13;
&#13;
&#13;

答案 1 :(得分:-1)

你是对的。要选择已禁用的元素,请使用disabled选择器:

:disabled {
    css declarations;
}