如何移除桌面的边距?

时间:2021-03-20 22:42:03

Edit: I had some code posted here but I couldn't get it to reproduce. So here is the link to the problem:

编辑:我在这里发布了一些代码,但是我无法复制。这就是问题的联系:

http://stackmobile.quickmediasolutions.com/questions.php?site=*

http://stackmobile.quickmediasolutions.com/questions.php?site=*

No matter what I do, there is still a gap between the table and the DIV. This occurs on Google Chrome 5.0.375.70 beta on Linux. (And it seems to occur on other Webkit-based browsers too.)

无论我做什么,表和DIV之间仍然有差距。这发生在Linux上的谷歌Chrome 5.0.375.70 beta上。(它似乎也出现在其他基于webkit的浏览器上。)

How can I get rid of the space?

我怎样才能摆脱这个空间?

4 个解决方案

#1


2  

Try using the following CSS:-

尝试使用以下CSS:-

div {
    margin: 0px;
    padding: 0px;
}
table {
    margin: 0px;
    border-collapse: collapse;
    padding: 0px;
}

#2


1  

There might be a space character between the div and the table. If yes then try removing that.

div和表之间可能有一个空格字符。如果是,那就尝试删除它。

Try giving

试着给

body
{
    font-size: 1px;
}

and check whether the 4px has been reduced or not.

并检查4px是否已经减少。

#3


1  

Try zeroing the div margin too:

试着调整div的页边距:

div {
    margin:0;
}

This is the full page I used, it seemed to work for me:

这是我用过的整页,似乎对我有用:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/\
xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <title>Test</title>
        <style type="text/css">
            div {
                width:2em;
                height:2em;
                background-color:black;
            }
            table {
                background-color:red;
                margin: 0px;
                border-collapse: collapse;
                padding: 0px;
            }
        </style>
    </head>
    <body>
        <div></div>
        <table>
            <tr><td>Test</td></tr>
        </table>
    </body>
</html>

#4


0  

I finally fixed it!

我终于把它修好了!

All I needed to add was

我需要补充的是

height: 40px;

to

#topbar_logo {
    float: left;
}

#1


2  

Try using the following CSS:-

尝试使用以下CSS:-

div {
    margin: 0px;
    padding: 0px;
}
table {
    margin: 0px;
    border-collapse: collapse;
    padding: 0px;
}

#2


1  

There might be a space character between the div and the table. If yes then try removing that.

div和表之间可能有一个空格字符。如果是,那就尝试删除它。

Try giving

试着给

body
{
    font-size: 1px;
}

and check whether the 4px has been reduced or not.

并检查4px是否已经减少。

#3


1  

Try zeroing the div margin too:

试着调整div的页边距:

div {
    margin:0;
}

This is the full page I used, it seemed to work for me:

这是我用过的整页,似乎对我有用:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/\
xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <title>Test</title>
        <style type="text/css">
            div {
                width:2em;
                height:2em;
                background-color:black;
            }
            table {
                background-color:red;
                margin: 0px;
                border-collapse: collapse;
                padding: 0px;
            }
        </style>
    </head>
    <body>
        <div></div>
        <table>
            <tr><td>Test</td></tr>
        </table>
    </body>
</html>

#4


0  

I finally fixed it!

我终于把它修好了!

All I needed to add was

我需要补充的是

height: 40px;

to

#topbar_logo {
    float: left;
}