CSS 出了什么问题?
我是 CSS 新手。看图片:
https://i.sstatic.net/Y9X6K.jpg
为什么img{border:右边的2px,solid,red;}
是穿线的,在浏览器中图像没有边框。
有人能告诉我原因吗?
I am a newbie to CSS.Look at the pic:
https://i.sstatic.net/Y9X6K.jpg
Why img{border:2px,solid,red;}
on the right is line-through,and in the browser the image hasn't border.
Anybody can tell me the reason?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
删除逗号,因为您的 css 语句不正确,因此检查器中会出现警告:
Remove the commas because, your css statement is incorrect, hence the warning in the inspector:
在开发者工具(例如 Chrome)中删除 CSS 规则意味着该规则未被应用。在你的情况下,这是因为你的CSS无效,不应该有逗号,即
这会扩展到所有速记CSS规则,即
它也可能意味着它在其他地方被覆盖,你可以在最后使用
!important
强制样式的声明,即A strike through a css rule in a developer tool such as in chrome means the rule is not being applied. In your case this is because your css is invalid there shouldn't be commas i.e
this expands to all shorthand css rules i.e
It can also mean it is being overridden somewhere else you can use
!important
at the end of a declaration to force the style i.e只需删除这些逗号并使您的 css 像这样
多个逗号用于定义多类 css。有关详细信息,请检查此 链接
Just remove those commas and make your css like this
multiple commas are used for define multi classes css.For more information check this link