所以,我有以下的样式组合作为我想要的。如果一个按钮或者是在focus
或active
状态,则该按钮的visibility: visible;
如何将多个选择器与相邻兄弟选择器结合使用?
.new-comment-button {
margin: 0.25em 0 0.5em 0;
float: right;
visibility: hidden;
}
.new-comment-input:focus + .new-comment-button,
.new-comment-button:focus {
visibility: visible;
}
.new-comment-input:active + .new-comment-button,
.new-comment-button:active {
visibility: visible;
}
我想要做的是最后2个款式组合成一个单一的一个当输入是状态,将工作要么active
或focus
。但是我想尽组合失败例如像以下:
.new-comment-input:focus + .new-comment-button,
.new-comment-input:active + .new-comment-button,
.new-comment-button:focus {
visibility: visible;
}
我也试过:
.new-comment-input:focus:active + .new-comment-button,
.new-comment-button:focus {
visibility: visible;
}
但是都没有成功。我可以坚持不同的风格,但我很好奇,是否有一种方法可以将它们恰当地结合起来,并解释input
的两种状态?
你可以添加html吗?或者做一个小提琴? – Venugopal
为什么这将是必要的?所有OP想要做的是将两个现有的工作规则组合成一个。 – BoltClock