我有两个同一类的标签。这是我这堂课的css:
.required
{
background-image:url(/img/required.png);
background-position: right;
background-repeat:no-repeat;
padding-right:10px;
}
在所有浏览器中,两个元素在右上角都有红色星标。但是在IE 7中只有第一个元素才有这个明星。我做错了什么?请帮帮我。
答案 0 :(得分:1)
不确定这会改变什么,但你试过吗
label .required
{css here}
答案 1 :(得分:1)
@ Alexander.Plutov:使用{<1}}我 borrowed 进行练习,以下代码示例似乎工作正常(我只是简化了您的{{1} }简写版本的规则):
required.png
您是否对表格中的任何内容使用了CSS
或<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.required
{
background: url(img/required.png) no-repeat right top;
padding-right: 15px;
}
</style>
</head>
<body>
<form action="4430474.htm" method="post">
<div>
<label for="field1" class="required">Field 1:</label>
<input type="text" name="field1" id="field1" size="40" />
</div>
<div>
<label for="field2" class="required">Field 2:</label>
<input type="text" name="field2" id="field2" size="40" />
</div>
</form>
</body>
</html>
规则?这些通常是IE6 / 7中行为不端的事情。