css - 专注于不同形式时更改 div 的宽度

标签 css

我无法让它正常工作

#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/

相关文章:

html - 嵌套的 Div 悬停内容定位不正确

java - CSS 未在已部署的应用程序中为 chrome 加载

html - 启用时更改复选框颜色

javascript - 除非在设置之前查询 DOM 样式属性,否则将忽略过渡时间

css - Firefox 的规模和硬件加速过渡问题

javascript - 表示没有用绝对路径加载图片

html - 扩展到父 Div 的全高的子 Div

html - 如何将带有工具提示的字形图标放入表单中

css - 在可选组件中重用 LESS mixin 类

html - 如何从我的网页中删除 Bootstrap 缩略图