我无法让它正常工作
#searchform:hover, #s:focus #searchform {width: 195px;}
当#s 被聚焦时,这不应该告诉#searchform 有一个 195px 的宽度吗?我在这里遗漏了什么吗?
#searchform 是#s 的父级,这就是原因吗?
最佳答案
The #searchform is a parent of #s would this be the reason why?
是的,您不能仅使用 CSS 根据其子项的状态选择父项。
关于css - 专注于不同形式时更改 div 的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13096021/