css定位间隙

css定位间隙,css,positioning,Css,Positioning,因为我以前没做过太多的工作,所以我在尝试学习一些CSS时遇到了一个问题,我在图像标签和ul标签之间有一小部分空间,并且不知道如何摆脱它 我说的是图片和黑条之间的空间,如上图所示 该页面的源代码如下(在asp.net mvc3中) 我弄乱了各种填充物、边距等,但似乎无法摆脱它,而且在布局窗格中的IE web developer工具栏中,它显示有一个偏移量(没有其他内容),但当我更改它时,它没有影响 我想这是我错过的一件小事,但我希望能得到一些帮助 干杯定位您的 CSS .myimg{宽度:IMG

因为我以前没做过太多的工作,所以我在尝试学习一些CSS时遇到了一个问题,我在图像标签和ul标签之间有一小部分空间,并且不知道如何摆脱它

我说的是图片和黑条之间的空间,如上图所示

该页面的源代码如下(在asp.net mvc3中)

我弄乱了各种填充物、边距等,但似乎无法摆脱它,而且在布局窗格中的IE web developer工具栏中,它显示有一个偏移量(没有其他内容),但当我更改它时,它没有影响

我想这是我错过的一件小事,但我希望能得到一些帮助

干杯

定位您的

CSS
.myimg{宽度:IMG\u宽度px;高度:IMG\u高度px;溢出:无;}


这应该可以消除你的空白

#menu
{
    background-color: Black;
    color: White;
    list-style: none;
    margin: 0px;
    padding: 0px;
    display:block;
    margin-top:-??px; //Here ?? is the unwanted space between the image and the bar
}

就这么简单

我看到三个黑条,没有图像,你能更具体地说明你想要发生什么吗?编辑:没关系,我想我明白了。对不起,徽标中的两个只是我删掉了公司特定的内容,css中唯一的一个是带有“主页”文本的。如果我决定更改徽标尺寸,有没有办法不必指定宽度/高度?你可以试试,但我非常怀疑
html, body
{
    font-size: 1.0em;
    font-family: Arial, sans-serif, Verdana, Garamond, "Segoe UI";
    color: #232323;
    background-color: #414042;
    height: 100%; /* needed for container min-height */
}
div#container
{
    position: relative; /* needed for footer positioning*/
    margin: 0 auto; /* center, not in IE5 */
    height: auto !important; /* real browsers */
    height: 100%; /* IE6: treaded as min-height*/
    min-height: 100%; /* real browsers */
    background-color: White;
    border-radius: 15px;
    min-width: 920px;
    width: 52%;
}



div#header
{
    padding: 1% 1% 0px 1%;
    margin: 0px;
}

div#footer
{
    position: absolute;
    width: 100%;
    bottom: 0; /* stick to bottom */
}

#menu
{
    background-color: Black;
    color: White;
    list-style: none;
    margin: 0px;
    padding: 0px;
}
#menu
{
    background-color: Black;
    color: White;
    list-style: none;
    margin: 0px;
    padding: 0px;
    display:block;
    margin-top:-??px; //Here ?? is the unwanted space between the image and the bar
}
#header img {
    display:block;
}