html - 如何使用 css 通过 href#id 隐藏 anchor 标记

标签 html css hide anchor href

我有不同的 href=#ids anchor 标记,我需要使用通用的 css 规则来隐藏它们,

Content xxxxxxxxx <a href="#tab1">Table 1</a>.Content xxxxxxxxxxxx <a href="#tab2">Table 2</a>

我正在尝试使用这样的东西:

#wrap a='#tab1'{
display:none;
}

知道怎么做吗?

最佳答案

尝试使用属性选择器:

a[href='#tab1']{ display: none }

或者甚至简单

[href='#tab1']{ display: none }

http://www.w3.org/TR/CSS2/selector.html

关于html - 如何使用 css 通过 href#id 隐藏 anchor 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9165479/

相关文章:

javascript - Angular 搜索框

php - 在 url (htaccess) 中隐藏参数(查询字符串),但将此参数发送到页面 (php)

javascript - 在javascript中根据条件将标题设置为图像

html - 问题制作被阻止的 div

css - 如何将 HTML5 全屏 API 应用于 div 背景图像

css - 更改 Algolia React Instant Search 组件的样式

css - 2 列 div 布局 : right column with fixed width, 左流体

javascript - "Uncaught TypeError: Cannot read property ' 添加事件监听器 ' of null"

android - 隐藏 chrome 上的移动浏览器地址栏(android)

shell - 如何编译tcl/shell代码(隐藏原始源代码)