当我将光标放在th上时,值为#34;#"文字颜色应为#f5f5f5。第二栏的其余部分不受影响。
不知道该怎么做。
由于
**CSS**
.makeThisOpacity {
}
.makeThisOpacityaa {
opacity: 0;
}
.makeThisOpacity > th:hover {
color: black;
background-color: #f5f5f5;
opacity: 1;
}

<html lang="en">
<head>
<title></title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.css" rel="stylesheet" />
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
</style>
<br>
<table class="table table-hover">
<tr class="makeThisOpacity">
<th class="makeThisOpacityaa">#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
</table>
</body>
</html>
&#13;
答案 0 :(得分:2)
color: black;
用于文字颜色
background-color: #f5f5f5;
用于背景色
你做的所有其他事情都是正确的
如果您只想将此款式应用于其中,则应将最后一个选择器更改为:th.makeThisOpacityaa:hover
答案 1 :(得分:0)
您尝试执行的操作无效,因为您将background-color
应用为color
而非background-color:
,color
属性将更改背景颜色,如名称所示。和.makeThisOpacity > th:hover {
color: #f5f5f5;
opacity: 1;
}
属性将更改文本颜色
试试这个
a="""<span><span data-oe-model="demo.demo" data-oe-id="33" id="a">@Joseph Walters</span> hi</span>"""
data_oe_model = re.findall(r'data-oe-model="(.*?)"', a)[0]
data_oe_id = re.findall(r'data-oe-id="(.*?)"', a)[0]
b = re.sub('span data-oe-model="(.*?)" data-oe-id="(.*?)"', 'a href='+data_oe_model+'/'+data_oe_id, a)
print b
Output: <span><a href=demo.demo/33 id="a">@Joseph Walters</span> hi</span>
答案 2 :(得分:0)
删除opacity:1
将解决您的问题。
**CSS**
.makeThisOpacity {
}
.makeThisOpacityaa {
opacity: 0;
}
.makeThisOpacity > th:hover {
color: black;
background-color: #f5f5f5;
}
<html lang="en">
<head>
<title></title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.css" rel="stylesheet" />
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
</style>
<br>
<table class="table table-hover">
<tr class="makeThisOpacity">
<th class="makeThisOpacityaa">#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
<tr>
<td>1</td>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
</table>
</body>
</html>