如何覆盖“边框:无”克服 Safari 选择错误?
我们刚刚在 Safari 中发现了一个非常随机的错误(至少在 Mac 上)。 Safari 似乎不喜欢应用于
但我们已将 border: none;
应用于我们的选择字段,以更好地匹配我们的样式。不过,它在其他浏览器(包括 Chrome)中似乎工作正常。
所以我需要知道如何为 Safari '覆盖'这种样式。我们专门为 Safari 创建了一个样式表,但我认为这不会有帮助,因为没有 border: auto;
值。尝试了 border:inherit
,但这也不起作用。
选项?有想法吗?谢谢!
We've just discovered a pretty random bug in Safari (at least on Mac). It seems that Safari doesn't like a border style applied to a <select>
tag. It will do different things depending on the version of Safari, from kind of working to no drop-down to refreshing the page.
But we've applied border: none;
to our select fields to match our styling better. It appears to work OK in other browsers though (including Chrome).
So I need to know how to 'override' this style just for Safari. We created a style sheet just for Safari, but I don't think this is going to help since there is no border: auto;
value. Tried border: inherit
, but this didn't work either.
Options? Ideas? THANKS!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您指的是文本框和其他输入周围的黄色/蓝色小边框,则需要添加属性outline:none;适合您的风格。
If you mean the little yellow/blue border around text boxes and other inputs, you need to add the property outline:none; to your style.
我知道 Safari 不喜欢您设置其选择标签的样式,即使您将其添加为 !important。我仍在寻找解决这个问题的方法。我用 div 标签定制了选择标签,但 Safari 上的大小调整有点混乱,因为它不允许我覆盖它的填充。如果您检查元素,单击“计算样式”,您可以看到这一点选中“显示继承”。
I know that Safari doesn't like you to style their select tags even if you add it in as !important. I'm still looking for ways around this. I have custom made select tags made out of div tags, but the sizing is a bit screwed up on Safari because it won't allow me to overwrite it's padding. You can see this if you inspect element, click on "Computed Styles", & check "Show Inherited".
这篇文章有点旧,但如果它会对任何人有帮助,这是我的解决方案,即使它不是最好的方法,但至少它对我有用。
我遇到了一个问题,我的 div 标签的宽度被 Safari 定义为“600px”(我从未在任何地方选择过这个尺寸),所以我将样式直接添加到我的 html 标签中:
This post is a bit old but in case it would help anyone, here is my solution even if it's not the best way to do this, but at least it worked for me.
I had an issue where the width of my div tag was defined at "600px" by Safari (I never chose this size anywhere), so I added the style directly to my html tag :