使用时添加保证金(Add margin when using)

编程入门 行业动态 更新时间:2024-10-25 06:20:56
使用时添加保证金(Add margin when using)

我正在使用Bootstrap和一个带有navbar-fixed-top类的导航栏。 下面是一个内部有图像的div(屏幕的全宽,高度为400px)。

问题是,由于我的导航栏具有背景颜色,导航栏会进入图像。 我尝试在图像上添加一个margin-top:80px,它工作正常,但当我低于769px x XXXpx时,我的导航栏和我的图像之间出现了一个空格。 我知道在调整窗口大小时这个空间来自边缘顶部,但是我可以做什么来将图像设置在导航栏下方而不添加边距顶部以使其正确显示?

我认为这是一个简单的问题所以我没有在我的帖子中添加代码,如果需要,我会。

I'm using Bootstrap and a navbar with navbar-fixed-top class on it. Below that is a div with an image inside (full width of the screen, height 400px).

The problem is that, since my navbar has a background-color, the navbar goes onto the image. I tried to add a margin-top:80px on the image, it works fine, but when I go below 769px x XXXpx, a space appears between my navbar and my image. I know this space is coming from the margin-top when resizing the window, but what could I do to set the image below the navbar without adding a margin-top for it to appear correctly ?

I thought this was simple issue so I didn't add code to my post, I will if needed.

最满意答案

尝试为图像包装CSS规则

@media (min-width: 768px) { your CSS rule for image margin-top: 80px here }

Try to wrap CSS rule for image in

@media (min-width: 768px) { your CSS rule for image margin-top: 80px here }

更多推荐

本文发布于:2023-04-27 15:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1327200.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:保证金   Add   margin

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!