简体   繁体   English

属性 'border:none' 在 Safari 浏览器中无法正常工作

[英]property 'border:none' doesn't work well in Safari Browser

I'm having some problems to apply the property 'border:none' in the safari browser.我在 safari 浏览器中应用属性“border:none”时遇到了一些问题。 I've tried to apply a css class named 'profile-label', that has a property 'border:none' into a tag 'label', like in the code bellow:我尝试将名为“profile-label”的 css class 具有属性“border:none”应用到标签“label”中,如下面的代码:

 .profile-label { border: none; cursor: pointer; }
 <label for="photo" class="profile-label" type="submit"> <img src="https://picsum.photos/536/354" alt="Foto" width="50" height="50" class="profile-photo" /> <input type="file" id="photo" hidden name="ProfileImage"/> </label>

That property doesn't work properly in safari (border: none), however works well in all others browsers.该属性在 safari(边框:无)中无法正常工作,但在所有其他浏览器中都可以正常工作。 Does anyone know why?有谁知道为什么?

Image with border in safari browzer: safari 浏览器中带边框的图像:

在此处输入图像描述

You might want to try adding the following property to your CSS:您可能想尝试将以下属性添加到 CSS:

outline: none;

Not sure I could answer why that happens, though.不过,我不确定我能回答为什么会这样。

It is showing a button border because of the label wraping the image with a type="submit" attribute.它显示了一个按钮边框,因为 label 使用 type="submit" 属性包装图像。

Safari is adding the default style of all buttons. Safari 正在添加所有按钮的默认样式。

Try adding -webkit-appearance: none ;尝试添加-webkit-appearance: none ; to your label style到您的 label 样式

Or remove the attribute type=submit或者去掉属性type=submit

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM