简体   繁体   English

HTML表单样式IE6问题!

[英]HTML Form styling IE6 issues!

I've got a simple form on a webpage (that doesn't actually submit any info), anyway in terms of layout it is as follows: 我在网页上有一个简单的表单(实际上并没有提交任何信息),无论如何在布局方面如下:

input output output
input output output
input output output
total total total

Each of the output and total fields have their own class (.disabledbox) and I have styled this as follows(CSS). 每个输出和总字段都有自己的类(.disabledbox),我将其设置为如下(CSS)。 They are all "disabled" form boxes: 它们都是“禁用”表格框:

.disabledbox {    
border:none;
text-align:center;
background-color:#ccc;
color:#000000;
}

Here's the HTML for said form: 这是表格的HTML:

<input name="text" id="text1"  disabled="disabled" class="disabledbox" value="£ 0"/>
    <input name="text" id="text2" disabled="disabled" class="disabledbox" value="£ 0"/>

My problem is that on the output fields I want the colour of the output to be black, this works fine in FF and Chrome but my problem is that I need to also support my nemesis IE6 (as that's what the majority of users here have) but for some reason in IE6 it just will not accept the style. 我的问题是在输出字段中我希望输出的颜色为黑色,这在FF和Chrome中工作正常但我的问题是我还需要支持我的克星IE6(因为这是大多数用户在这里有的)但出于某种原因,在IE6中它只是不接受这种风格。 Am I doing something wrong? 难道我做错了什么?

You can achieve that with readonly="readonly" 你可以通过readonly="readonly"实现这一点

<input name="text" id="text1"  readonly="readonly" class="disabledbox" value="£ 0"/>

That's not completely disabling the input, but it will prevent editing. 这并不是完全禁用输入,但它会阻止编辑。

The "disabled" style of the input is "hardcoded" in IE6 and can not be overridden. 输入的“禁用”样式在IE6中是“硬编码”的,不能被覆盖。 I'd suggest not to use disabled inputs here. 我建议不要在这里使用禁用输入。 You have two alternatives: 你有两个选择:

  1. Use readonly instead: <input name="text" id="text1" readonly="readonly" class="disabledbox" value="£ 0"/> 改为使用readonly<input name="text" id="text1" readonly="readonly" class="disabledbox" value="£ 0"/>

  2. Don't use inputs. 不要使用输入。 You can just use a <div> or <span> and set its innerHTML instead. 您只需使用<div><span>并设置其innerHTML即可。 You can style the <span> or <div> anyway you like. 您可以随意设置<span><div>样式。

Try to use the css only for ie6? 尝试仅为ie6使用css?

<!--[if IE 6]>
  <link rel="stylesheet" type="text/css" href="ie-6.0.css" />
<![endif]-->

in this Css use _color: #youcolor; 在这个Css中使用_color: #youcolor;

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

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