开发者

HTML Spacing issue

开发者 https://www.devze.com 2023-01-24 20:05 出处:网络
I have the below code to display a simple table in a classic asp page inside of a Sharepoint WebPart.There are three cells because they are individually filled with an ADODB recordset.

I have the below code to display a simple table in a classic asp page inside of a Sharepoint WebPart. There are three cells because they are individually filled with an ADODB recordset.

However....there is about a quarter to half an inch of dead white space around the table. I would like the data in the table to show in the very upper left corner of the开发者_Python百科 page. Any ideas?

<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>


Try using:

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


do this:

<table cellpadding="0"....

maybe you need to set border="0" as well if you don't use it.

HTH


The body has a padding by default. Use

<body style="padding: 0px">

to solve that.


Use a developer toolbar such as FireBug or the built in webkit toolbar. Use the element selector and examine the styling of the element. It will show you where there is padding/margin.


This is a very good 'master stylesheet' that clears / levels the browser field. You should ALWAYS zero everything out before you apply any kind of styles.

/* 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; }


Did you guys hear of putting CSS inside the STYLE element? :) You know, separation of content and presentation...

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

精彩评论

暂无评论...
验证码 换一张
取 消