更改backgroundColor更改边框 [英] changing backgroundColor changes border

查看:135
本文介绍了更改backgroundColor更改边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IE7中,单击下面的文本框将边框更改为插图。

它在最新的FireFox中正常工作,但不在v3.0.10中。

In IE7, clicking the textbox below changes the border to inset.
It works fine in the latest FireFox, but not in v3.0.10

<html>
<head></head>
<body>
   <input type="text" readonly="readonly" value="hello" onclick="this.style.backgroundColor='white';" />
</body>
</html>

奇怪的怪癖


对于那些使用IE8的人,它是否是固定的? >
我的解决方法是使用this.style.border =1px solid black;重置边框。

Strange quirk.
For those with IE8, is it fixed?
My workaround is to reset the border using this.style.border = "1px solid black;"

推荐答案

我测试过的浏览器:Opera 10.70,Firefox 3.6.9,IE 8.0更改为插页。 Webkit(Chrome 5.0.375.70和Safari 5.0.2)也会更改为插图,但仅限于设置的颜色与当前颜色不同时。

Browsers I've tested: Opera 10.70, Firefox 3.6.9, IE 8.0 changes to inset. Webkit (Chrome 5.0.375.70 and Safari 5.0.2) also changes to inset but only when color to set is different than current color.

每个浏览器的外观都不相同控件,我称之为默认外观。您可以自定义控件(例如更改其背景的颜色),然后更改为,我称之为可定制的外观。它将其属性更改为标准,可由CSS编辑,这在每个浏览器上应该都是相同的。可定制外观的input-type = text的默认属性是inset。

Every browser has different look of their controls, I call it a default look. You can customize control (e.g. change color of its background), then it changes to, what I call, a customizable look. It changes its properties to standard, editable by CSS, which should look the same on every browser. Default property for border-style of customizable-looking input-type=text is "inset".

类似的机制影响自定义滚动条。如果你设置一个颜色,滚动条将是矩形的,因为只有这样它才能被着色。

Similar mechanism affects customizing scrollbars. If you set a color, scrollbar will be rectangular, because only then it can be colored.

这篇关于更改backgroundColor更改边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆