Why did my #wrapDesktopNavBar disappear on desktop view? - css

The following is my css. i'm not sure why when i open up my website on dekstop view, my #wrapDesktopNavBar does not show. Please help me look at it thanks :)
#media screen and (min-width: 800px) {
/* Navigation bar (blank) settings */
#wrapDesktopNavBar {
visibility: visible;
width: 100%; /*Sets the width*/
height: 70px; /*Sets the height*/
top: 0%; /*Sets the distance from the top*/
position: relative; /*Fixes the bar at the designated position*/
background-color: #ffffff; /*Sets the background color to white*/
font-family: Helvetica, Arial, sans-serif; /*Sets the font of the headers*/
z-index: 1; /*Sets as 1 to be the top layer, bottom layers should use small index number, vice versa*/
}}
#wrapDesktopNavBar {
height: 100%;
background-color: #315AA9;
position: fixed;
width:80%;
top:0%;
overflow-y:auto;
overflow-x: hidden;
visibility: hidden;
z-index: 100;
}

You are using #media query in your CSS, so the above bit of code has two declarations of the same id so you need to close the media query block so that it excludes the general style block
#media screen and (min-width: 800px) {
/* Navigation bar (blank) settings */
#wrapDesktopNavBar {
visibility: visible;
width: 100%;
height: 70px;
top: 0%;
position: relative;
background-color: #ffffff;
font-family: Helvetica, Arial, sans-serif;
z-index: 1;
}
} /* Close this here */
/* Other styles goes out of the box */
The order of your declarations matter there, even if the first condition is satisfied, the general CSS property block will override the media query block, inorder to prevent that, just place the media query at the end of your CSS file.
Also, you are using visibility: hidden; so even if you close the #media query box and if the viewport width exceeds 800px; your element having an id wrapDesktopNavBar won't be visible.
Demo (Resize the fiddle window to see the effect, tinkered with media query width and color for demo purposes)

Related

Mobile fixed position social share widget position change when scrolling

I use CSS and HTML based social sharing plugin for my WordPress site. It's natively not supporting fixed position. Then I used the following additional CSS to make it sticky only on the mobile devices. I think max-width: 767px is ok for mobile devices (if I'm wrong please correct).
It works on my tested device, but when I'm scrolling page this widget position slightly changes and again it comes to the fixed position.
How do I fix this position change? For better understanding, I added gif at the end of the post.
#media only screen and (max-width: 767px) {
.socialsharing {
position: fixed;
top: 90%;
-webkit-transform: translateY(-7.5%);
-ms-transform: translateY(-7.5%);
transform: translateY(-7.5%);
display: flex;
width: auto-flow;
bottom: 0;
margin-right: auto;
margin-left: auto;
justify-content: center;
}
I hope this answer will help you to fix your problem, there are a lot of ways to handles fix footer issues definitely but I prefer this kind of class which is really simple to understand because you set a div or body to 100% of viewport height and then margin-top: auto and bottom:0; will fix the stack in footer all the time problem. Good Luck
.h-100{
height : 100vh;
}
.button {
background-color: orange;
}
/* I added class here to show how its working in Code Snippet, you don't need to do this part of css*/
.socialsharing {
position:fixed;
bottom:0px;
width: 100%;
margin-top: auto !important;
display: block !important
padding: 10px;
padding-bottom: 0px;
text-align: center;
z-index: 999;
}
/*end of extra Css*/
#media only screen and (max-width: 767px) {
.socialsharing {
position:fixed;
bottom:0px;
width: 100%;
margin-top: auto !important;
display: block !important
padding: 10px;
padding-bottom: 0px;
text-align: center;
z-index: 999;
}
}
<div class="h-100">
<div class="bodyContent">
<h3> Social Media in Footer </h3>
</div>
<div class="socialsharing">
<input type="button" value="StackOverflow" class="button"/>
</div>
<div>

CSS media query rule not being applied

At line 449 of this page, there is:
#media (min-width: 981px) {
#tdr-gallery-our-work .wpb_image_grid .wpb_image_grid_ul .isotope-item {
max-width: 9.09090909% !important;
position: relative !important;
left: auto !important;
top: auto !important;
}
}
However, if I inspect the LI element of the image gallery in the middle of the page, code inspector says that only the following rule is being applied:
.wpb_image_grid .wpb_image_grid_ul .isotope-item {
list-style: none;
margin: 0 1px 1px 0;
max-width: 8.92857142%;
height: auto;
float: left;
position: relative !important;
left: auto !important;
top: auto !important;
}
The div#tdr-gallery-our-work definitely contains this image gallery, but it's not even being detected by the code inspector. It's in the source code, so why isn't it being applied?
I am in a browser on a 1680px monitor, and the media query takes place at (min-width: 981px).
Help appreciated.

Website not covering full screen in portrait view

I have designed responsive website viz working perfectly in laptop and landscape view of Tab and mobile.
When I've checked that in portrait view body tag is not covering full screen, A white vertical band appear in right side of the screen.
Landscape view:
No error... Working Perfectly...
Portrait View:
Body is not covering full page....
Body tag CSS:
body{
font-family: 'Raleway','Arial Narrow', serif;
width: 100%;
font-weight: 400;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
margin:0 !important ;
padding:0 !important
}
You've used box-sizing: content-box; for the class fs-container viz causing the issue, its your <body> is covering your full website but due that property on class there is white-space.
I've used this CSS:
#media screen and (max-width: 570px) {
.fs-container {
position: relative;
width: 100%;
padding: 0 20%;
max-width: 100%;
left: 35px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.fs-block {
width: 100%;
}
}
#media screen and (max-width: 380px) {
.fs-container {
padding: 0 15%;
}
}
on particular media-query, please try this, it will do the trick for you.
I check this in my Developer Tools and everything worked fine.
Maybe the problem is your code you posted:
overflow-x: hidden;
margin:0 !important ;
padding:0 !important
Please check your semicolon:
overflow-x: hidden;
margin:0 !important;
padding:0 !important;
Make sure you are using a universal selector for margin and padding.
* {
margin: 0;
padding: 0;
}
Sometimes it will create some problems.

Fixed Header stays when scrolls but navigation doubles

I currently am using a fixed header for my website: http://www.destinykingproductions.com/test/ I have attached the css I currently have. Anyone have any suggestions on why this is happening?
#main {
background-color: transparent;
margin-top: -40px;
height: auto;
max-height: none;
width: auto;
padding-bottom: 35px;
}
header#masthead {
height: 103px;
background-image: url(http://www.destinykingproductions.com/test/wp-content/uploads/2014/08/header_bg1.jpg);
position: fixed;
z-index: 856;
width: 100%;
margin-top: 0px;
top: 0px;
}
nav.main-navigation {
top: -200%;
background-color: transparent;
z-index: 4670;
}
nav.main-navigation ul.menu li {
padding-left: 17px;
}
nav.main-navigation ul.menu {
margin-left: 18%;
}
#shiftnav-toggle-main {
display: none;
}
Thank you for your assistance!
The comments above are correct - the "sticky" class nav is being added / toggled at some point. When you add 'display:none' to that sticky class, then it is fine on a desktop view. However, it looks like you are using that class for something with mobile because when the screen is resized smaller and back to normal then the side menu area doesn't go away. It looks like you may want to move that sticky class to your 768px media query and/or have it not show on larger screens.
/*normal css*/
.main-navigation.sticky { display: none }
#media screen and (max-width: 768px)
{
.main-navigation.sticky { display: block }
}

Hide Nivo slider caption for mobile devices

Hi I was wondering if anyone could help me with this. At the moment I have a Nivo Slider, with a Nivo Caption set to display: none; at a certain screen size. It has come to me attention that for some people, seems like iPhones, the caption displays, and creates a white space to the right (too big for the current size), until refreshed. Is there a better way to 'get rid' of an element for mobile?
Thanks.
Al.
You're overwriting a CSS rule.
At some point on the Stylesheet you have:
.theme-light .nivo-caption {
display: none;
}
A bit further:
.nivo-caption {
-moz-box-sizing: border-box;
background: none repeat scroll 0 0 #000000;
bottom: 10%;
color: #FFFFFF;
display: block;
height: 66px;
left: 0;
opacity: 0.9;
overflow: hidden;
padding: 5px 10px;
position: absolute;
width: 440px;
z-index: 8;
}
display: none;
and then
display: block;
I would go for a jQuery approach to get rid of the caption, based on the screen size or even detecting if it's a smartphone (modernizr).
in the jquery.nivo.slider.js
add:
//Process caption
if ($(window).width() < 659) {
$('.nivo-caption').hide();
}
else {
processCaption(settings);
}

Resources