Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用CSS隐藏HTML元素_Html_Css - Fatal编程技术网

用CSS隐藏HTML元素

用CSS隐藏HTML元素,html,css,Html,Css,我想将每个CSS的HTML元素设置为“隐藏”。不幸的是,元素的反应不像是由我的代码处理的。 这是我的代码: .archive-header { display: none; } HTML代码: <html> <head>...</head> <header>...</header> <div id="main" class="wrapper"> <section id="primary" class="sit

我想将每个CSS的HTML元素设置为“隐藏”。不幸的是,元素的反应不像是由我的代码处理的。 这是我的代码:

.archive-header {
    display: none;
}
HTML代码:

<html>
<head>...</head>
<header>...</header>
<div id="main" class="wrapper">
<section id="primary" class="site-content">
<div id="content" class="main">
<header class="archive-header"> <!-- hide this header element and everything inside -->
<h1 class="archive-title">...</h1>
</header>
...

...
...
...
...
更新
很抱歉,我的文本编辑器更改了引号,原始代码使用了正确的引号。

您必须使用正确的引号

<div id="main" class="wrapper">
<section id="primary" class="site-content">
<div id="content" class="main">
<header class="archive-header"> <!-- hide this header element and everything inside -->
<h1 class="archive-title">...</h1>
</header>

...

用真实的引号替换你的引号:“,应该足够了

试试这个

<header class="archive-header"> <!-- hide this header element and everything inside -->
   <h1 class="archive-title">...</h1>
</header>

...
只能使用“或”引用属性值

<html>
<head>...</head>
<header>...</header>
<div id="main" class="wrapper">
<section id="primary" class="site-content">
<div id="content" class="main">
<header class="archive-header"> <!-- hide this header element and everything inside -->
<h1 class="archive-title">...</h1>
</header>

...
...
...

您的引号有些奇怪。尝试将“存档标题”替换为“存档标题”这些引号是什么?class=“archive header”
“main”
“main”
不是相同的。在源代码或此处使用这些特殊的引号字符?如果您正确地修复了引号,则可以使用