You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Orbeon Forms:为指定表单字段设置聚焦时的背景色

聚焦样式设置方案

已知可通过以下CSS为普通文本输入框和纯文本域设置聚焦时的样式:

.xforms-input input:focus {color: black !important; background-color: blue !important; }  
.xforms-textarea textarea:focus {color: black !important; background-color: pink !important; } 

针对你需要的三类字段,对应的CSS规则如下:

数字字段(Number fields)

数字字段通常归属于.xforms-input类,可直接复用现有规则,或用更精准的选择器锁定类型:

/* 精准匹配数字类型输入框 */
.xforms-input input[type="number"]:focus {
    color: black !important;
    background-color: blue !important;
}

格式化文本域(Formatted text area)

格式化文本域一般使用.xforms-rich-textarea类,需同时匹配内部的文本域或编辑器容器:

.xforms-rich-textarea textarea:focus,
.xforms-rich-textarea .editor:focus {
    color: black !important;
    background-color: pink !important;
}

货币字段(Currency fields)

货币字段多属于.xforms-input下的输入框,可通过类名或属性特征匹配:

/* 通过类名包含currency的特征匹配 */
.xforms-input input[class*="currency"]:focus {
    color: black !important;
    background-color: blue !important;
}

/* 或通过名称属性包含currency的特征匹配 */
.xforms-input input[name*="currency"]:focus {
    color: black !important;
    background-color: blue !important;
}

如果上述选择器未生效,建议用浏览器开发者工具(F12)查看字段的实际HTML结构和类名,调整选择器以匹配真实元素。


内容的提问来源于stack exchange,提问作者Pete Atkin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 17:05:08