2014-02-20 65 views
0

即时通讯做网站,但我的头问题。 我想要一个标题就像stackoverflows的听者,但我的头获取空间在侧面和顶部。 这是我的CSS:网站全宽标题

@charset "utf-8"; 
/* CSS Document */ 
.logo { 
    vertical-align: top; 
    position: relative; 
    height: auto; 
    width: auto; 
} 
#header { 
    background-color: #E7E7E7; 
    margin: auto; 
    width: 100%; 
    heigth: 100; 

} 

这是我的html:

<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>Kifhood.se</title> 
<link href="Untitled-3.css" rel="stylesheet" type="text/css"> 
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--> 
<script>var __adobewebfontsappname__="dreamweaver"</script> 
<script src="http://use.edgefonts.net/advent-pro:n1,n3:default.js" type="text/javascript"></script> 

</head> 

<body> 
<div id="header"> 
      <div class="wrap"> 
       <div class="logo"> 
        <p style="font-family: advent-pro; font-style: normal; font-weight: 300; font-size: 36px; color: #FFFFFF; min-width: 0px;">Testing site</p> 
       </div>    
      </div> 
    </div> 
</body> 
</html> 

,这是我的结果 http://gyazo.com/4b0329b097fe51db377258f99d0fe2c9

+0

您已经删除填充和利润率从身体和HTML元素? – kthornbloom

+0

我的头里没有看到任何空格。毕竟,你正在使用'position:fixed'((0,0))。 – Sachin

回答

3
body 
{ 
    margin:0px; 
    padding:0px; 
} 

这将解决白色周围的内容。

重要

随着柜龙指出,该段将有通过头撞击余量。这会导致额外的空白。将其替换为另一个元素(例如文本的'span'或块内容的'div')。

+0

Rawr!有一个upvote。 –

0

尝试:

#header { 
background-color: #E7E7E7; 
margin: 0; 
width: 100%; 
heigth: 100; 

} 
0
body { 
margin-top: 0px; 
margin-right: 0px; 
margin-bottom: 0px; 
margin-left: 0px; 
} 
+1

你有不必要的代码,你可以写'body {margin:0;}' – vsgoulart

+0

只是在未来的情况下,他想保持边缘在一边,然后他可以改变每一个。 – lukehemingway

0

两件事:

  • 使用<div>代替<p>为贵 “试验场” 的内容。 <p>有一些内置的垂直边距。
  • <body>添加样式删除默认的保证金浏览器可能会增加

这里有一个工作的jsfiddle http://jsfiddle.net/t5XwZ/

0

改变你的CSS这样:

#header p { 
    margin: 0; 
    padding: 0; 
} 

body 
{ 
    margin:0px; 
    padding:0px; 
} 

JSFiddle Demo

0

您很可能正在运行陷入了各种浏览器所应用的默认样式差异的问题。如上所示,您可以将margin:0和padding:0添加到html元素,但会遇到其他不一致情况。我会强烈考虑使用css重置或正常化来修复大部分这些不一致情况。

我使用Eric Meyer的2.0版本,但也有许多可供选择:http://www.cssreset.com/