How to make WordPress navigation static - css

I'm looking to make my navigation in WordPress static. By this I mean I wish for it to remain at the top of a user's browser regardless of how far down he/she scrolls. The effect I'm looking for is similar to one found at http://www.chevrolet.com/
Any advice or guidance in the right direction would be appreciated.
Thanks,
D

Find the template code for your wordpress navigation
Check what class it uses
Modify the css for that class using
.yourNavClass {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
}
There you have it!

Changing the following should do it.
ref:
1. line 63 of main.css
2. line 203 of main.css
#container #mds-area-header {
position:relative;
top:0px;
margin-top:0px;
padding-top:0px;
}
#mds-area-header .nav_second_level_1 {
margin-top:0px;
}

Related

Sticky Menu on oceanwp theme

I'm using oceanwp theme,
I want to have topbar that disappears when scrolling and the menu will jump to the topbar place (with opacity) i was trying this code
#site-header {
position: fixed;
left: auto;
width: 100%;
z-index: 2000;
opacity: 0.9;
}
and that not working,
the menu is stick in his place and there is a hole in the topbar place,
someone know how to fix it?
Can you send to us link to your site, this gonna make everything more easy. If, this 'sticky' menu is creating with jquery or vanilla js then your css fixes doesn't change anything. Just check your js files for ".scroll(" and you should find this snippet.
//Sorry for my english skills :/
window.onscroll = function() {myFunction()};
function myFunction() {
if (document.documentElement.scrollTop < 50) {
document.getElementById("site-header").style.top='auto';
} else{
document.getElementById("site-header").style.top=0;
}
}
I know it's not the best semantic solution, but its should work for your site. Add this to custom js, or another js file.
I checked on your site and its working :)
Just add this code to your custom CSS/js in the theme customizer section and vuala!
#site-header {position: stuck; left: auto;
width: 100% z-index: 2000;opacity: 0.9;
}
This one worked for me
#site-header {
position:fixed !important;
z-index:1000;
top:0;
width: 100%;
}
#main {
margin-top: 70px !important; /* 70px - width of the header. This can be changed from the theme customizer */
}

CSS not aligning properly, overlapping another box

Having a bit of an issue with a Drupal site. If you take a look here and look down at the facebook block, it's overlapping the blocks above it, the twitter one is not doing this. I have tried various changes in Drupal but nothing has changed. Anyone have any idea how to make it line up with the twitter one?
It is the two margin top properties asigned to the .block-facebook-wall. Disable those.
.block-facebook-wall {
/* margin-top: -7.36714em; */
}
media (min-width: 38em){
.block-facebook-wall {
width: 48.93617%;
clear: right;
float: right;
margin-right: 0;
/* margin-top: -6.8541em; */
}
}

Why is my layout breaking?

I've been trying to use Firebug to inspect the elements on my page to see why the pruduct image is dropping down below the configuration box on the right instead of being near the top of the page without much luck. Can anyone see what the issue is?
I've asked the theme developer and they said that Cart2Quote plun breaks the Argeto layout. I'm sure I can tweak the CSS and fix this but I can't find the issue. Can anyone see the problem?
http://dev.globalamericaninc.com/index.php/le-37i-g-3-5-embedded-mini-board-with-intel-skylake-6th-gen-core-h-series-processor.html
you must have an element (or more) that has {clear : left} or {clear : both} in the right side. Google what clear does in CSS
change below CSS rules:
default.css line 742
.product-view .product-img-box {
float: left;
width: 445px;
}
default.css line 746
.product-view .product-shop, .col1-layout .product-view .product-shop {
float: right;
/*
float: none;
margin-left: 385px;
width: auto;
*/
}

Less Variables on left side

I admit I am fairly new to less. While playing with it to make my site as dynamic as possible I was trying to use less variables so if I had to change something I could just do it in one file.
I have run across an issue though when trying to position elements. For example I have a button that is currently sitting on the left side, but in the future I may want to move it to the right. Normally how you call that is either left:0; or right:0;
Is there a way to make that left, or right a variable?
My css looks like this
.previous{
position:fixed;
left:0; //The left is what I want to declare somewhere else
top:#header-padding;
height:#side-height;
font-size: #button-side-font !important;
}
I have tried something like
#{prevPos}: left;
and then calling
#prevPos: 0;
but it just stopped loading my application altogether.
Mixins (update)
Have you tried using a mixin?
It could look something like this:
.previous {
.previous-position();
font-size: #button-side-font !important;
height: #side-height;
position: fixed;
top: #header-padding;
}
.previous-position() {
left: 0;
// right: 0;
}
To swap the left and right, change the comment in the mixin.
Multiple classes approach (original answer)
I'd actually approach this differently. Instead of having the button styles and positioning in the same CSS rule, I'd have the positioning in a sub-class.
.previous {
font-size: #button-side-font !important;
height: #side-height;
}
.previous-left,
.previous-right {
position: fixed;
top: #header-padding;
}
.previous-left {
left: 0;
}
.previous-right {
right: 0;
}
Then your buttons look like this:
I am on the left
I am on the right
I am not fixed
This way you can update your page pretty quickly without having to tear apart your LESS files and it makes your styles more re-usable.
And yet another answer for how to get it to work in a "variable way" using old-fashioned method (intentionally using the most conservative syntax so it could work even with ancient compilers):
#previous-position: right;
.previous {
position: fixed;
margin: 1em;
font-size: 400%;
.-(left) {left: 0}
.-(right) {right: 0}
.-(#previous-position);
}

How to add background img in wordpress3.5.1

How can I add a background image or color to my Wordpress 3.5.1?
My Wordpress theme doesn't have "background" in the Appearance widget in my Wordpress dashboard.
Of course you can use multiple solutions for that. I will give 2 sollutions.
In your file .css set the backround-color like this:
.body{
background:#000000;
}
You can use a class to handle that:
.backround {
position:absolute;
backround:#000000;//or, instead #000000; use url(path_to_image);
width: 100%;
z-index: 999;
min-height: 30px;
left:0;
padding-top:10px;
}
This is it!

Resources