Problem
I can't get a consistent position for my navigation menu vertically. It is presently in the correct position on most pages, but on internal e-course pages it is lower and I don’t know why. I've changed the code a bit in trying to figure things out and I can no longer find the vertical positioning code—though I thought it was there when I looked at it a few days ago and yet the position on most pages is correct!
I wonder what is the position measuring from?. I coded it (when I thought there was a code for the vertical position) thinking it was measuring from the top of the page which is something that doesn't change from page to page, but if that were the case it would not change on the internal e-course pages.
Motive
I need a second navigation menu on a Wordpress site I am setting up for e-courses. The navigation menu that comes with the theme is set above the header and I want a navigation at the bottom of the header that matches and basically links my other sites. The menu should basically look like the ones here: http://www.midlifecrisismarriageadvocate.com/stand.html and at my blog. Though I think I would like it if it were more like the second (WP blog) example where all the items do not spread out to take up the entire width of the navigation bar.
I added the second menu by following the instructions from this post: http://premium.wpmudev.org/blog/add-menus-to-wordpress/. I've also posted my latest problem ther—though I recently changed the css again—with no resolution to my problem. I also posted my problem at the wordpress.org forums and received no response.
Theme
I am using a child theme I created from the theme that came with the Zippy Courses plugin—social triggers for zippy courses theme.
CSS Code
Sorry for all the notes; I got this from some online tutorial and customized it for my colours. I've added to some of the notes with my changes, comments or confusions.
.top-nav {
height: 45px;
padding: 0;
margin: 0;
position: absolute; /* Ensures that the menu doesn’t affect other elements */
border-right: 0px /*solid #a5dcc2; */
}
.top-nav li {
height: auto;
width: auto; /* Each menu item was 148px wide, changed to auto */
float: left; /* This lines up the menu items horizontally */
/*text-align: center;*/ /* All text is placed in the center of the box, removing this changed nothing--text is still centered */
list-style: none; /* Removes the default styling (bullets) for the list */
/*font: normal bold 14px;*/
font-family: Georgia, Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
background-color: #b7f5d7;
}
/*The next code styles the anchor tags that are found in each list item. Each anchor tag is the same size and shape as the list item.*/
.top-nav a {
padding: 2px 0; /* Adds a padding on the top and bottom so the text appears centered vertically */
border-left: 0px solid #BEF6DB;
border-right: 0px solid #a5dcc2;
text-decoration: none; /* Removes the default hyperlink styling. */
color: c91640
display: block;
}
/*The next style is responsible for changing the color of each menu item’s background when hovered over with a mouse pointer. .*/
.top-nav li:hover, a:hover {
background-color: #82bfa2;
font-color: #ffffff
}
/*The next two styles are related. The first style hides the drop-down menu, while the second style displays it when a mouse pointer is hovered over the main menu item.*/
.top-nav li ul {
display: none; /* Hides the drop-down menu */
height: auto;
margin: 38px; /* Aligns drop-down box underneath the menu item */
padding: 0; /* Aligns drop-down box underneath the menu item */
}
.top-nav li:hover ul {
display: block; /* Displays the drop-down box when the menu item is hovered over */
Related
I have some stuff I'd like to change in my dropdown. The website is https://community.entermedschool.com/
Below is the list of things I have tried along with the code I used. But none of them seem to be working...
Increase the font size for all of the items in the dropdown menus.
Change the font-weight for all the items in the dropdown to 400.
#primary-menu * {
font-size: 17px;
font-weight: 400;
}
Auto-scale the dropdown size so that all the items fit in one line.
.sub-menu {
width: fit-content;
}
Any help would be much appreciated!
Thanks in advance!
Edit:
The dropdown with which I want these changes is the primary header which I have highlighted here:
I want all of the dropdowns to basically expand automatically so that all of the content 'breathes' in it.
Your width: fit-content; is working but there is no space left for the ::after (the right arrow >). Therefor you could add a margin-right to each li in the submenu (for example 15px) and subtract that amount from the right-property of the ::after:
.sub-menu li {
margin-right: 15px;
}
.site-header .sub-menu .menu-item-has-children:not(.hideshow):after { {
...
right: 0; //instead of 15px
...
}
It works if i change it in the dev tools...
I created a drop down menu with menubar. However I have custumization problems :
The transparency is well done, but the size of the horizontal items is too hight (and so not vertically centered. The required height is thirty pixels all inclusive ;
(just resolved with height: 30px; in passive mode (neither hover nor seleted). The selection "Button" item in the horizontal menu remains too hight
The vertical menu items are too separated from each over and the width of the vertical menus too narow ;
The movement in the verticals menu items not be materialized (with a blue color) as it is in the horizontal menu;
Impossible to move to a submenu with a mouse. Only with keybord arrows. Why ?
I tried a long time the css with modification of the "theme.css" of the saga-blue theme, but nothing to do nothing works except the css lines included in my code :
Code:
.p-menubar {
background: transparent;
padding: 0;
height: 30px;
}
What are the particular css elements and clauses to modify ?
Eventually, using Chrome's inspector, I ended up discovering the CSS classes involved. By groping on the values I got about what I wanted.
The impacted code:
In the vue.js file:
<div id="menuU" class="user-menu" v-show="isvisible()">
<Menubar:model="items" class="p-menubar"></Menubar>
</div>
the v-show parameter is application specific and not given here.
In css:
.menu-utilisateur {
background-color: lightgrey;
height: 30px;
}
.p-menubar {
background-color: lightgrey;
padding: 0px;
height: 30px;
}
.p-menubar .p-menubar-root-list > .p-menuitem > .p-menuitem-link {
padding: 0.5rem 1rem !important;
}
.p-menubar .p-menuitem-link {
padding: 0.5rem 0.5rem !important;
}
Don't forget the !important. It overwrites the default values.
I had this kendo treeview. When select a node or sub's-node I want the orange color at full line and same with others (refer to image below).
I to use script below, but when it come to sub's-group the align is not same. Appreciate your help.
.k-treeview span.k-in {
margin-left: -10%;
padding-left: 10%;
padding-right: 60%;
}
DEMO IN DOJO
The way the tree currently works is that the li.k-item have a left padding of 16px, so for the second level it's 32px and so on.
What you need to do is put the indenting mechanism somewhere else. Your li.k-item must have no left padding, but a div inside must. Depending on your item template, it will be something like:
.k-treeview li > div { padding-left: 16px }
.k-treeview li li > div { padding-left: 32px }
.k-treeview li li li > div { padding-left: 48px }
You can generate a dozen levels with less or sass.
When you have this, you can style the selected row:
li[aria-selected="true"] { border: 2px solid orange }
I found this link some time ago and have used the styles with the AJAX Tab Container control with changes over the years in different projects:
http://www.c-sharpcorner.com/uploadfile/raghavau/css-style-sheet-for-ajax-tabcontainer-control-in-Asp-Net-2-0/
The link is just for reference but the problem I'm having is in IE 11.
It works ok in FF and Chrome.
The problem is, while viewing in IE, the left and right sides (images) of the tab have a greater height. This leaves and empty gap at the bottom of each tab where the inner portion is.
Picture three images. Left and right are 20px and the inner is 17px and all aligned at the top. And I have checked, all images have the same height.
There is also a visible dashed box around the active tab's text and the bottom of this dashed box happens to align with the bottom of the repeated inner image. Active, hover, and inactive styles are all the same except for the image.
Here is some css to view for the inactive tabs but it does the same thing on all tabs whether inactive or not.
/*Header*/
.Tab .ajax__tab_header {
color: #4682b4;
font-family: Calibri;
font-size: 14px;
font-weight: bold;
margin-left: 0px;
white-space: nowrap !important;
}
/*Body*/
.Tab .ajax__tab_body
{
border:1px solid #b4cbdf;
padding-top:0px;
min-width:900px;
}
/*Tab Inactive*/
.Tab .ajax__tab_tab
{
color: #666666;
background:url("../images/tab_Inactive.gif") repeat-x;
height:20px;
display:block;
line-height:20px;
}
.Tab .ajax__tab_inner
{
color: #666666;
background:url("../images/tab_left_inactive.gif") no-repeat left;
padding-left:4px;
}
.Tab .ajax__tab_outer
{
color: #666666;
background:url("../images/tab_right_inactive.gif") no-repeat right;
padding-right:4px;
margin-right: 2px;
}
I have been looking everywhere for a solution and even a coworker who knows styles better than I do is at a loss as to why it does not work properly in IE 11.
Thanks for any suggestions.
EDIT: First the dotted box around a selected tab is solved. Just needed to add outline: 0px;
And after closer inspection, it looks like the middle image background is not smaller, but the position is not on the bottom like it should be. Adding background-position: bottom; did not help.
Finally found the solution and wanted to post it for others.
When I noticed the image was not smaller but it was raised, I looked closer at other elements. All that was needed for IE 11 to behave was vertical-align: bottom; Adding this to all the tab styles (hover, active, inactive, inner, outer, tab) did the trick.
I am creating a website on Wordpress and I would like to have a horizontal navigation menu in my header with the logo in the center as a link to the homepage. I have been able to create this look using the Wordpress menu, but when I look at the website on my phone the "home" link is situated in the center, which isn't how I would like it to be ordered.
Using the current template (HTML) is there a way to finagle the CSS so the nav menu looks similar to these guys: http://bostonscally.com?
Thanks!
#mpcth_page_header_content #mpcth_logo_wrap #mpcth_logo {
display:none;
}
#mpcth_page_header_content {
text-align: center;
padding: 0px 0px 0px 0px;
}
#mpcth_menu {
font-size: 18px;
font-weight: bold;
padding: 10px;
display: inline-flex;
}
#mpcth_menu .menu-item-166 > a {
position: relative;
background-image:url('/wp-content/uploads/2014/01/Bostin-Irish-Header_Woo.png');
background-repeat: no-repeat;
background-position: 0px 0px 0px 0px;
width: 300px;
height: 100px;
text-indent: -9000px;
padding: 0px;
}
#mpcth_page_header_content #mpcth_controls_wrap {
padding-right: 2em;
vertical-align: middle;
}
I recently answered a question similar to this.
It can be found here: How to add a custom item to a specific WordPress menu item position
There are 3 options as i said in the answer above.
jQuery, PHP or HTML/CSS and its down to what you are most comfortable with and if it is for a client, what they most prefer.
I would personally go with the PHP way and split the navigation in 2 and have the logo in the middle.
EDIT
So you'll need the jQuery version.
Your navigation will need to be setup with Home being the first element on the navigation. This will mean that the mobile version will have home as the first link.
Next you need to add the jQuery below underneath your inclusion of the jQuery library
jQuery(document).ready(function() {
jQuery("ul#mpcth_menu").find("li:contains('Home')").hide(); // hides home from navigation
var position = jQuery("ul#mpcth_menu li").length-1;
var i = 0;
jQuery('ul#mpcth_menu li').each(function() {
if(i == position/2) {
jQuery(this).after('<img src="http://www.bostonirishclothing.com/wp-content/uploads/2014/01/Bostin-Irish-Header_Woo.png" width="250" />');
}
i++;
});
});
This code removes the first element from the main nav, being the Home button, then figures out how many is left and places the logo into the middle.
You will also need to remove the CSS which adds the logo to the class menu-item-166 as this may cause problems.
Hope this fixes your problems.
DEMO