聚焦和一个元素应该反映到CSS中的另一个元素 [英] Focusing and one element should reflect to another element in CSS
问题描述
使用CSS样式。
来到我的案例。如果我专注于输入元素,那么完全在div(包含输入元素)之外的div的边框应该改变边框颜色。为此,我已经经历了几个片段。但它没有正常工作。我可以获得确切的代码段或提示吗?不使用java脚本或j查询
Im working with CSS styling.
Coming to my case. If I focus on input element then the border of a div which is completely outside of that div(which contains input element) should change the border color. For this I have gone through few snippets. But its not working properly. Can I get exact snippet or hints for this ? without using java script or j query
input[type=email]:focus + div.emailicon,
{
border-color: #e86740;
box-shadow: none;
outline: none;
}
推荐答案
div.emailicon {
border: 3px solid;
}
input[type=email]:focus + div.emailicon
{
border-color: #e86740;
box-shadow: none;
outline: none;
}
Here is the js fiddle you can check it out.
编辑:我改变了我犯了一个愚蠢的错误,现在它应该工作精细,这意味着你的初始代码工作正常。为我的愚蠢错误道歉。
Edited: I change back the , into + as I realise that I made a silly mistake, now it should works finely, which means your initial codes are working fine. Apologise for my silly mistake.
这篇关于聚焦和一个元素应该反映到CSS中的另一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!