简体   繁体   English

WordPress-从div分离导航栏所需的CSS帮助

[英]WordPress - CSS help needed to seperate navbar from div

This is my current website: jigsawcreations.net As you can see, it looks normal on a monitor, but whenever you resize the screen to an iPhone for instance, some content of the slider gets hidden by the navbar. 这是我当前的网站:jigsawcreations.net如您所见,它在监视器上看起来很正常,但是每当您将屏幕调整为iPhone尺寸时,导航栏就会隐藏一些滑块内容。 I currently have no margins or paddings between any elements from the .main or the navbar, yet it still gets changed with different resolutions. 目前,.main或导航栏中的任何元素之间都没有边距或填充,但是仍然会以不同的分辨率进行更改。 I tried inspecting the HTML code many times on the page to see what could be causing this, but I failed. 我尝试在页面上检查HTML代码很多次,以查看可能是什么原因造成的,但是失败了。

Thanks in advance! 提前致谢!

Edit: I see that the navbar and the .main get caught up as they are both part of body. 编辑:我看到导航栏和.main被捕获,因为它们都是身体的一部分。 They are both set as blocks, but navbar is fixed. 它们都设置为块,但是导航栏是固定的。 Could this be the cause? 这可能是原因吗?

You need to change the display on your navbar from fixed to relative. 您需要将导航栏上的显示从固定更改为相对。

.navbar-fixed-bottom, .navbar-fixed-top{
    position: relative;
    right: 0;
    left: 0;
    z-index: 1030;
}

I see there's JavaScript in place to automatically shift down the .main container so it begins below the .navbar (it looks like this when you inspect, and changes when you resize: <div class="main" style="margin-top: 114px; min-height: 1px;"> ). 我看到有JavaScript可以自动向下移动.main容器,因此它在.navbar下面开始(检查时看起来像这样,而在调整大小时发生变化: <div class="main" style="margin-top: 114px; min-height: 1px;"> )。

But, then you have custom CSS on a WP plugin that's preventing that margin-top from taking effect (found in this file ): 但是,然后您在WP插件上有了自定义CSS,从而阻止了该margin-top生效(在此文件中找到):

div.main {
    margin-top: 0px!important;
}

Remove that custom CSS override to let the JS do its thing, and your slideshow will always begin below the navigation bar, instead of overlapping underneath it. 删除该自定义CSS替代项即可让JS完成其工作,并且幻灯片放映将始终在导航栏下方开始,而不是在其下方重叠。

How about pushing the slider div down? 向下推滑块div怎么样?

div#n2-ss-2-align {
    margin-top: 74px;
}

If you decide to go this route you will have to set different margin value for different screen size for when your header changes the height. 如果您决定采用此路线,则必须在标题更改高度时针对不同的屏幕尺寸设置不同的边距值。

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

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