Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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
Html 显示:无不显示';不要隐藏div内容_Html_Css - Fatal编程技术网

Html 显示:无不显示';不要隐藏div内容

Html 显示:无不显示';不要隐藏div内容,html,css,Html,Css,这应该是显而易见的,但在所有主流浏览器中,div内容都不会隐藏: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> <style> #confContent{ border:solid 1px #FF0000; width:7

这应该是显而易见的,但在所有主流浏览器中,div内容都不会隐藏:

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>

<style>
    #confContent{
    border:solid 1px #FF0000;
    width:700px;
        height:600px;
    background-color:#00CC00;
    left:50%;
    display:none;
    position:absolute;
                                                }

</style>

</head>

<body>

        <div id="confContent">
        <p style="color:#0000FF">Some content goes here</p>
        </div>


</body>
</html>

试验
#满足{
边框:实心1px#FF0000;
宽度:700px;
高度:600px;
背景色:#00CC00;
左:50%;
显示:无;
位置:绝对位置;
}
这里有一些内容


实际上,所有的属性似乎都不起作用,
div
没有向左移动30%,没有背景色,没有隐藏,也没有边框。请帮忙。Thanx。您的CSS需要在样式标签中(如果不是在外部样式表中)


#满足{
边框:实心1px#FF0000;
宽度:700px;
高度:600px;
背景色:#00CC00;
左:30%;
显示:无;
}   
并且应该放在页面的
标题中

查看新代码时,您缺少文档开头的HTML标记(应该在
之后)


但是,我也不认为这是问题所在-我认为可能还有一些CSS我们没有看到,它们正在覆盖您提供给我们的div属性。

将您的代码替换为:

<!--Confirmation div-->
<div id="confContent">
   <p style="color:#0000FF">Some content</p>
</div>

<style type="text/css">
#confContent{
    border:solid 1px #FF0000;
    width:700px;
    height:600px;
    background-color:#00CC00;
    left:30%;
    display:none;
}     
</style>

一些内容

#满足{ 边框:实心1px#FF0000; 宽度:700px; 高度:600px; 背景色:#00CC00; 左:30%; 显示:无; }

使用Danny Hearnah关于头标签的建议

您错过了
width
属性的
px
。除此之外,它还在工作。检查这个


如果这仍然不起作用,那么您需要检查您的CSS文件路径

我的问题已经解决,对于任何对此有困难的人,请不要在CSS块中使用

<style>

<!-- DO NOT use this format for comments -->

/* Only this format is valid */

</style>


它是隐藏在铬。另外,请使用width:700px而不是width:700px。您的页面中的其他地方一定有问题;您的代码(正如您在此处输入的那样)工作正常:更新了我的答案-您在新的代码样式中缺少了
标记,除了文档头之外,其他任何地方都不能出现标记。我假设你已经知道这一点,并且只是用标签来说明,但我怀疑OP可能需要被告知这一点。谢谢@GordonM的精确性。是的,我已经知道这一点,但更容易解释的是,将样式标记直接放在HTML代码下面,关于malloc问题,这是显而易见的,当然我将所有内容都放在
head
标记之间的
样式
标记中,很抱歉在我的帖子中没有提及:)我编辑了我的帖子,这次我移动到一个空白文件进行测试。同样的问题,css代码未被解释。请尝试将type=“text/css”添加到样式标记中。。。诚实地说,代码是有效的!嗨,我编辑了我的帖子,一切都很明显,我把我的代码移到了新的文件中,看看它在处理我的原始帖子时是否有问题。但是,同样的问题也会出现,css代码似乎不起作用。
<style>

<!-- DO NOT use this format for comments -->

/* Only this format is valid */

</style>
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol. 
Unexpected end of file while searching for closing } of invalid rule set.