【发布时间】:2018-07-01 00:32:16
【问题描述】:
我尝试编写一些 CSS 代码。不幸的是,我无法更改 html 代码 ,只有样式部分。在我的项目中,我在 css 文件中有样式。 这是一些代码:
<!DOCTYPE html>
<html>
<head>
<style>
h1.my_class {
visibility: visible !important;
}
</style>
</head>
<body>
<h1 class="my_class" hidden>This is a heading</h1>
</body>
</html>
我可以用我的 css 代码覆盖用 html 代码编写的“隐藏”吗?已经写的东西不会改变任何东西。
【问题讨论】:
-
如果要显示,是否应该在元素上设置隐藏属性? - developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/…: 隐藏的全局属性是一个布尔属性,表示该元素尚未或不再相关。 hidden 属性不得用于隐藏可以在另一个演示文稿中合法显示的内容
标签: html css visibility