2010-11-11 218 views
1

我有下面的代码来在Sharepoint WebPart内部的传统asp页面中显示一个简单的表。有三个单元格,因为它们分别填充了一个ADODB记录集。HTML间距问题

但是......桌子周围约有四分之一到五分之一的死空白空间。我希望表格中的数据显示在页面的左上角。有任何想法吗?

<html> 
<body > 
<table Border="1" width="300" bgcolor="white"> 
    <tr> 
     <td><FONT face="Arial" color="navy" size=1>DEV DW STATUS: </td> 
     <td><FONT face="Arial" color="navy" size=1>COMPLETE</td> 
     <td><FONT face="Arial" color="navy" size=1>11/11/2010 3:41:34 AM</td> 
    </tr> 
</table> 
</body> 
</html> 
+1

这段代码看起来很'99。 :D – 2010-11-11 16:04:20

+1

确保摆脱那些令人讨厌的''标记,那些标记已经过时,不要将它与CSS混合使用。聪明的使用CSS类 – Jakub 2010-11-11 16:31:14

+0

此外,bgcolor属性已被弃用。使用'table {background-color:white;而不是。 – 2010-11-11 16:38:03

回答

1

尝试使用:

<body style="margin: 0px; border: 0px; padding: 0px"> 
... 
</body> 
+0

@icyrock .... boooYahhhh ....那是我做的。谢谢 – MikeTWebb 2010-11-11 16:27:42

+1

@MikeTWebb更好:'body {margin:0;填充:0; }'(你不必为body元素设置边框) – 2010-11-11 16:34:53

0

做到这一点:

<table cellpadding="0".... 

也许你需要设置边界= “0”,以及如果你不使用它。

HTH

0

身体有默认的填充。使用

<body style="padding: 0px"> 

解决这个问题。

0

使用开发人员工具栏,如FireBug或内置的webkit工具栏。使用元素选择器并检查元素的样式。它会告诉你哪里有填充/保证金。

0

这是一个非常好的“主样式表”,它清除/分级浏览器字段。在应用任何类型的风格之前,您应该始终将所有内容都排除在外。

/* Global Defaults */ 
html, body { 
margin: 0px; 
padding: 0px; 
border: 0px; 
} 

body { 
font: 1em/1.25 Arial, Helvetica, sans-serif; 
} 

/* Headlines */ 
h1, h2, h3, h4, h5, h6 { 
margin: 0; 
padding: 0; 
font-weight: normal; 
font-family: Arial, Helvetica, sans-serif; 
} 

/* Text Styles */ 
p, th, td, li, dd, dt, ul, ol, blockquote, q, acronym, abbr, a, input, select, textarea { 
margin: 0; 
padding: 0; 
font: normal normal normal 1em/1.25 Arial, Helvetica, sans-serif; 
} 
blockquote { 
margin: 1.25em; 
padding: 1.25em 
} 
q { 
font-style: italic; 
} 
acronym, abbr { 
cursor: help; 
border-bottom: 1px dashed; 
} 
small { 
font-size:.85em; 
} 
big { 
font-size:1.2em; 
} 

/* Links and Images */ 
a, a:link, a:visited, a:active, a:hover { 
text-decoration: underline; 
} 
img { 
border: none; 
} 

/* Tables */ 
table { 
margin: 0; 
padding: 0; 
border: none; 
} 

/* Forms */ 
form { 
margin: 0; 
padding: 0; 
display: inline; 
} 
label { 
cursor: pointer; 
} 

/* Common Classes */ 
.clear { clear: both; } 
.floatLeft { float: left; } 
.floatRight { float: right; } 
.textLeft { text-align: left; } 
.textRight { text-align: right; } 
.textCenter { text-align: center; } 
.textJustify { text-align: justify; } 
.blockCenter { display: block; margin-left: auto; margin-right: auto; } /* remember to set width */ 
.bold { font-weight: bold; } 
.italic { font-style: italic; } 
.underline { text-decoration: underline; } 
.noindent { margin-left: 0; padding-left: 0; } 
.nomargin { margin: 0; } 
.nopadding { padding: 0; } 
.nobullet { list-style: none; list-style-image: none; } 
+0

...或者只是使用Yahoo CSS Reset。 – 2010-11-11 16:07:52

+0

...或许多其他免费的重置脚本;) – Jakub 2010-11-11 16:30:07

0

你们听说过把CSS放在STYLE元素里面吗? :) 你知道,内容和演示文稿的分离...

<style> 
    body { padding:0; margin:0; } 
</style>