相关疑难解决方法(0)

CSS Margin:0未设置为0

我是网页设计的新人.我使用CSS和HTML创建了我的网页布局,如下所示.问题是即使我将边距设置为0,上边距也没有设置为0并留下一些空间.我怎样才能清除这个空白区域?

屏幕截图的问题

顶部有一个空间

样式表

<style type="text/css">
body{   
    margin:0 auto; 
    background:#F0F0F0;}

#header{
    background-color:#009ACD; 
    height:120px;}

#header_content { 
    width:70%; 
    background-color:#00B2EE;
    height:120px; 
    margin:0 auto;
    text-align:center;}

#content{   
        width:68%; 
        background-color:#EBEBEB;
        margin:0 auto; 
        padding:20px;}
</style>
Run Code Online (Sandbox Code Playgroud)

HTML

<body>
    <div id="header">
     <div id="header_content">
           <p>header_content</p>
       </div>
    </div>
<div id="content">
Main Content
</div>
</body>
Run Code Online (Sandbox Code Playgroud)

这是整个文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Book Shop</title>
<style type="text/css">
html, body, #header {
    margin: 0 !important;
    padding: 0 !important;
}
body{   
    margin:0;    padding: 0;
    background:#F0F0F0;}

#header{ …
Run Code Online (Sandbox Code Playgroud)

html css margin

24
推荐指数
3
解决办法
10万
查看次数

浏览器支持CSS中的askerisk(*)通配符?

哪些浏览器能够正确理解和实现CSS中的星号(*)?(通过'恰当'我的意思 - '因为他们应该'.)

考虑这个CSS代码,例如:

pre .comment * {
  color: #800;
}
Run Code Online (Sandbox Code Playgroud)

编辑:我现在看到它被称为'*选择器'或'通用选择器'.非常感谢您的投入.:)

css wildcard css-selectors

6
推荐指数
1
解决办法
5054
查看次数

页面顶部有额外的空白区域

我正在网站上工作,我注意到我的页面顶部和底部有一个无法解释的空白区域.我搜索了一些帖子,他们告诉我确保我使用了没有BOM的UTF-8编码,我尝试了它并没有区别.如果有人愿意看它,网址就是网址

html css

2
推荐指数
1
解决办法
8732
查看次数

标签 统计

css ×3

html ×2

css-selectors ×1

margin ×1

wildcard ×1