[英]Changing CSS styling onHover and onClick event
On hover of any of the above items I want to surround item with a box having grey color background.在悬停上述任何项目时,我想用一个具有灰色背景的框围绕项目。
and onclick I want to change it to something like below (surround with a box having background color as text color, change text color to white and have ax in the box).和 onclick 我想将其更改为如下所示的内容(用背景颜色作为文本颜色的框包围,将文本颜色更改为白色并在框中放置 ax)。 Clicking on x should bring it back to the normal state as depicted in image 1.单击 x 应使其恢复到正常状态,如图 1 所示。
Current code:当前代码:
export default class GridSummary extends Component {
renderJobStateSummary() {
const jobCountSummaryDiv = [];
if (this.props.jobStateCount.size !== 0) {
jobCountSummaryDiv.push('Summary: ');
for (const state of ['Total', ...jobStatesPriorityOrder]) {
if (this.props.jobStateCount.has(state) &&
this.props.jobStateCount.get(state) !== 0) {
const cssClass = `${JOB_STATES_CSS_CLASS[state]} clickable`;
jobCountSummaryDiv.push(
<span
className={cssClass}
role="link"
tabIndex="-1"
key={state}
>
{JOB_STATE_DISPLAY_NAME[state]}: {this.props.jobStateCount.get(state)}
</span>
);
jobCountSummaryDiv.push(' | ');
}
}
}
return jobCountSummaryDiv;
}
render() {
return (
<div className="summary-panel">
{ this.renderJobStateSummary() }
</div>
);
}
}
Try with pseudo class combination of :hover and :active.尝试使用 :hover 和 :active 的伪类组合。 For guest it likes button.对于客人,它喜欢按钮。 In style border option use combination of inset and outset, it gives very good visuel.在样式边框选项中使用 inset 和 outset 的组合,它提供了非常好的视觉效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.