简体   繁体   English

HTML CSS DIV边距顶部无效

[英]HTML CSS DIV margin-top doesn't work

I'm trying to make a menu bar that is vertically on the right side of the screen. 我试图使菜单栏垂直位于屏幕的右侧。 The menubar should touch the horizontal main navigation bar on the top, but i can't set the top margin of the vertical bar to zero. 菜单栏应触摸顶部的水平主导航栏,但我无法将垂直栏的顶部边距设置为零。

Here: https://www.dropbox.com/s/azz5diwqzfchued/Schermafdruk%202015-09-08%2022.22.09.png?dl=0 此处: https//www.dropbox.com/s/azz5diwqzfchued/Schermafdruk%202015-09-08%2022.22.09.png?dl = 0

is a screenshot of how chrome inspect element shows the problem, this might make things a bit clearer. 是chrome inspect元素如何显示问题的屏幕截图,这可能会使情况更加清晰。

Thanks in advance! 提前致谢!

According to the element inspector your margin-top style got a syntax problem. 根据元素检查器的说法,您的页边空白样式遇到了语法问题。 From the looks of it I'd say you used a double ':' (colon) character. 从外观上看,我会说您使用了一个双':'(冒号)字符。 Try removing the double ':' character and try again. 尝试删除双':'字符,然后重试。

If this still doesn't work, maybe another style is overriding your new one so you could try: 如果仍然无法解决问题,则可能是另一种样式覆盖了您的新样式,因此您可以尝试:

margin-top: 0 !important;

This will make sure this style will always have the highest priority. 这样可以确保此样式始终具有最高优先级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM