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

如何在AppMaker中修改文本框边框样式?聚焦状态CSS失效求助

Fixing Focused TextBox Border Color in AppMaker

Hey Johan! I’ve run into similar struggles overriding Material Design styles in AppMaker before—let’s break down why your CSS isn’t sticking and how to fix it.

Common Reasons Your CSS Isn’t Taking Effect

  1. Insufficient CSS Specificity
    Material Design’s default styles often have higher specificity than custom CSS you add. Your current selector might be getting overridden by the framework’s built-in styles without you noticing.

  2. Wrong Target Element/Property
    AppMaker’s Material-style TextBoxes rarely use a simple border-bottom for that focus underline. Most of the time, they render that animated line using a ::after pseudo-element, not the input’s direct border property.

  3. Incorrect Class Names
    Double-check the actual classes applied when the TextBox is focused—sometimes AppMaker uses hyphenated modifier classes like .app-TextBox--focus instead of the .focus you’re targeting.

Step-by-Step Solution

1. Inspect the DOM with Browser DevTools

First, right-click your TextBox and select "Inspect" (Chrome/Firefox). When you focus the input, look at the active classes on the TextBox container and input element. You’ll probably see something like:

<div class="app-TextBox app-TextBox--focus">
  <input class="app-TextBox-Input" ...>
</div>

Also, check if the underline is coming from a ::after pseudo-element on the input or container (look under the "Elements" tab’s "Styles" panel for pseudo-element styles).

2. Update Your CSS with Correct Selectors

Based on what you find in DevTools, try one of these options:

Option A: Target the Input’s Border (if applicable)

If the underline is a direct border on the input, use a more specific selector (or add !important as a last resort):

.app-TextBox.app-TextBox--focus .app-TextBox-Input {
  border-bottom-color: green !important;
}
Option B: Target the Pseudo-Element (most common for Material Design)

If the underline is a ::after pseudo-element, target that instead:

.app-TextBox.app-TextBox--focus .app-TextBox-Input::after {
  background-color: green;
  /* Or border-bottom-color, depending on how it’s styled in your AppMaker setup */
}

3. Ensure CSS is Injected Correctly

Make sure you’re adding this CSS in the right place:

  • Go to App Settings > Custom CSS for app-wide styles
  • Or add it to a specific page’s Custom CSS section for page-specific changes

Test and Tweak

After updating your CSS, refresh your app and focus the TextBox. If it still doesn’t work, go back to DevTools and check if your style is being applied (look for strikethrough text, which means it’s overridden). Adjust the selector specificity or use !important temporarily to confirm it works, then refactor for cleaner specificity if possible.

内容的提问来源于stack exchange,提问作者Johan W.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 04:05:54