【发布时间】:2021-04-23 18:25:27
【问题描述】:
有一个类inputBlog 有一个背景图像。我需要更改此背景图像以聚焦输入元素。
但在 SASS 中找不到如何操作。
JSX:
<div className={styles.inputBlog}>
some text
</div>
</div>
<div className={styles.inputSection}>
<input type="text"
现有的 CSS:
.inputBlog {
background: url('image.png')
}
.inputSection {
input {
border-left: 0;
&:focus {
.inputBlog {
background: url('differentimage.png');
}
}
}
}
【问题讨论】:
-
您能否更好地组织您的问题。您说您想更改输入父级的背景,但唯一的背景样式是 inputBlog 不是输入的父级
-
@UdenduAbasili 嗨,现在好些了吗?
-
background: url('diffirent image');