如何用tailwindcss禁用环形阴影?

发布于 2025-01-31 11:22:29 字数 820 浏览 3 评论 0原文

这就是我的问题的样子(请参阅戒指):

查看图像

使用Chrome的检查员发现它与- TW-RING SHADOW有关。 因此,我尝试添加ring-0ring-offset-0之类的类(如下所示),但它不起作用!

    import { TextField } from "@mui/material";
    
    
    function ContactForm(): JSX.Element {
      return (
        <div className="form-container pt-12 flex flex-col items-center">
          <div className="input-row">
            <TextField
              className="ring-offset-0 ring-0"
              label="First Name"
              variant="outlined"
            />
          </div>
        </div>
      );
    }
    
    export default ContactForm;

您是否知道如何摆脱这个烦人的边界,这与输入字段重叠?

感谢您的帮助!

This is how my problem looks like (see the ring) :

View Image

Using the Chrome's inspector found that it is related to --tw-ring-shadow.
So I tried adding classes like ring-0 and ring-offset-0 (as you can see below) but it didn't work!!

    import { TextField } from "@mui/material";
    
    
    function ContactForm(): JSX.Element {
      return (
        <div className="form-container pt-12 flex flex-col items-center">
          <div className="input-row">
            <TextField
              className="ring-offset-0 ring-0"
              label="First Name"
              variant="outlined"
            />
          </div>
        </div>
      );
    }
    
    export default ContactForm;

Do you have any idea for how can I get rid of this annoying border that overlaps the input field??

I'd appreciate your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖上得阳光 2025-02-07 11:22:29

您可以尝试通过在您的应用程序的CSS中添加以下内容来覆盖输入字段的尾风CSS变量:

input {
  --tw-ring-shadow: 0 0 #000 !important;
}

另外...我们看不到&lt; textfield&gt;生成的代码,以确保您的尾随效用类正正确地应用于输入元素,但是如果没有,您可以尝试使用&gt;字段来定位&lt;字段,使用@Apply在您的CSS文件中:

input {
  @apply ring-offset-0 ring-0
}

You could try overriding the Tailwind CSS variable for input fields by adding the following in your application's CSS:

input {
  --tw-ring-shadow: 0 0 #000 !important;
}

Alternatively...we can't see the code generated by <Textfield> to ensure that your Tailwind utility classes are being applied correctly to the input element, but if they are not, you could try targeting the <input> field directly using @apply in your CSS file:

input {
  @apply ring-offset-0 ring-0
}
计㈡愣 2025-02-07 11:22:29

尝试添加焦点:在这样的课程之前:

<TextField 
className="focus:ring-offset-0 focus:ring-0" 
label="First Name" 
variant="outlined" />

此更改确保在单击输入字段时应用样式的“ RING-FORFSET-0”和“ RING-0”。

Try adding focus: before your classes like this:

<TextField 
className="focus:ring-offset-0 focus:ring-0" 
label="First Name" 
variant="outlined" />

This change makes sure that the styles 'ring-offset-0' and 'ring-0' are applied when you click on the input field.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文