我需要使用CSS隐藏HTML文档中所有出现的单词。这可能吗?
不包含标识符或类,html是web scraper操作的结果
例如
<tr class="">
<th>EUROS BILLETE</th>
<td>30.10</td>
<td>31.99</td>
</tr>
在示例代码中,我需要隐藏的BILLET字,不是可以添加任何html标记,代码是来自web scraper动作的结果。
答案 0 :(得分:3)
没有。在html / css中,您可以隐藏元素,而不是文本。您应该将单词包装在span
等元素中并隐藏元素
<span class="text-to-hide">Whatever to text you want to hide</span>
span.text-to-hide
{
display:none;
}
答案 1 :(得分:0)
<table>
<tr class="cell">
<th class="hides">EUROS BILLETE</th>
<td>30.10</td>
<td>31.99</td>
</tr>
</table>
jquery的
$(function() {
//
//$('th:contains("EUROS BILLETE")').css('display', 'none');
//or
$('.hides').filter(function() {
return $(this).html().indexOf('BILLETE') != -1;
}).remove();
var th=$('<th>' + "EUROS" + '</th>');
$('.cell').append(th);
});
CSS
<p class="youclass">paragraph</p>
.youclass{
display: none;
}
and mostrate
.youclass{
display: block;
}