Wordpress main menu first item highlighted by default - css

i have this site in wordpress, which has a menu
and the css property which changes the color on hover
.main-navigation a:hover {
background: #fa5742;
color: #f1f1f1;
}
i want Home to be highlighted by default, how can i do that?
i am new to wordpress,therefor i might be missing the simplest of tricks here.

proper way to do it is by highlighting the current menu item
.main-navigation li.current_page_item a {
background: #fa5742;
color: #f1f1f1;
}

Please Write Css (use First Child)
.main-navigation li:first-chile a {
background: #fa5742;
color: #f1f1f1;
}

If you're using a standard WordPress menu you could use the .current_page_item class to highlight the page the user is currently on.
.main-navigation li.current_page_item a {
background: #fa5742;
color: #f1f1f1;
}
If like you describe you simply wish for the first item to always be highlighted you can use the following CSS.
.main-navigation li:first-child a {
background: #fa5742;
color: #f1f1f1;
}

Related

can't highlight the current menu item/page wordpress

I'm trying to edit a menu in wordpress but I can't seem to give the current page menu item the background colour that I want (highlight effect).
When I put in this bit of css...
ul#menu-menu-1.nav.navbar-nav a {
background-color: #FFFFFF;
z-index:9999999;
}
...the link background went white (which is what I wanted). Then I added this:
ul#menu-menu-1.nav.navbar-nav a:hover {
background-color: #34676b;
}
ul#menu-menu-1.nav.navbar-nav a:active {
background-color: #34676b;
}
The a:hover works, but a:active doesn't. Next I tried...
.current_page_item and .current_page_item a:active
...but nothing works, the code below is what I have now and it doesn't work either. Any help will be much appreciated, hopefully all css (I don't know php).
Thanks,
Lisa
ul#menu-menu-1.nav.navbar-nav {
padding-top:30px;
}
ul#menu-menu-1.nav.navbar-nav a {
background-color: #FFFFFF;
z-index:9999999;
}
ul#menu-menu-1.nav.navbar-nav a:hover {
background-color: #34676b;
}
ul#menu-menu-1.nav.navbar-nav li.current_page_item a:focus {
background-color: #34676b;
}
li#menu-item-14.menu-item.menu-item-type-custom.menu-item-object-custom.current-menu- item.current_page_item.menu-item-home.menu-item-14.active {
background-color: #34676b;
}
If I understand this right, you just want to highlight the current page link?
If so:
li.current_page_item a {
background-color: #34676b;
}
Should work.
It searches for the active <li> and then styles the <a> inside it.
I had almost the same problem and I used the following code to solve it.
li.current-menu-item a {
background-color: #34676b;
}
And just in case you want to change the color of the text once the item menu is selected:
li.current-menu-item a {
color: #34676b;
}

How do you style Wordpress sub-menus with CSS?

I'm trying to style my wordpress sub-menu with CSS to show only when a user hovers the "Color" menu item but I haven't succeed so I need some help please.
Here's how my menu looks like at this state:
The sub-menu shows all the time and there is a weird space after the "Color" menu item. Also, the sub-menu items are displayed one after another and not one below other like a drop-down menu should be.
Could you please help me out?
I'm aware that there are some similar questions to this one but they were of no help.
EDIT: added current CSS menu code that I have in my style.css
nav.main { float: left; }
nav.main li { float: left; margin-right: 11px; }
nav.main li.last-child { margin-right: 0; }
nav.main li a {
color: #7A0018;
display: block;
font-size: 13px;
padding: 50px 7px 22px 7px;
text-decoration: none;
}
nav.main li a:hover { background: #fbf6dc; }
nav.main li.current-menu-item a { background: #fbf6dc; }
where is css for your child list items ? you haven't use display property for those sub-menu which should be done none first then only on hovering them you have to change display property 'block'.
You have given margin-right property 11px; where as ul on default also occupies some margin.
Can you also provide your html frame (code)?

active class link in joomla

Hi I'm trying to make a joomla site here, only one problem I can't seem to figure out. The color of my active link doesn't change, it has an image and a color, the image is in place as it should be, but the color doesn't change. Anyone an idea? here's the css:
a {
color: #ffffff;
text-decoration: none;
}
a:link, a:visited {color: #ffffff; text-decoration: none;}
a:focus, a:hover {
color: #e2231a;
text-decoration: none;
}
#links li.active {
color: #e2231a;
text-decoration: none;
background: url("../images/hover.png") bottom center no-repeat;
padding-bottom: 17px;
}
I know the active statement looks different then the rest, but this was the only way to get my image to show. Really stuck on this..
Used to this for a tag
#links li.active a {
// here style for your anchor link
}
If you want just the list elements within Links to change when active use this.
#links li:active a {color:#000;}
If you want all lists to be effected by this change use
li:active a {color:#000;}
If you want more than just the li elements to change ie ever single link on the site that is active to obey these rules then use the following
a:active {color:#000;}
Hope this helps you out.

In css code a:active is not working

I am using CSS code like this
.top_nav ul li a{
color: #444; background: #111;
}
.top_nav ul li a:hover{
color: #fff; background: #555;
}
.top_nav ul li a:active{
color: #111; background: #fff;
}
But the problem is this when any page is active, on navigation menu that link's background not change. Background of that link is same as other's.
You are probably looking for focusing an active link in your menu with different color. Mind that a:active is not intended for that purpose.
A link only takes up the a:active state when it is clicked, so you only see the change for a few seconds. You should look for a different way for getting it done, like adding a new css class for the selected menu item from your server side script.
The active is only applied when you click on it. Do it like this:
<li>Link</li>
And then style it
top_nav ul li a.active {
color: #111;
background: #fff;
}
The a:active selector refers to active state of a link, not your active page.
http://www.w3schools.com/cssref/sel_active.asp
You will have to set some "active page" class to your menu item for the page you are currently viewing and refer to that in yor CSS.
If you have static HTML pages, you can add a class to your navigation items representing the current active page:
<li class="current">...</li>
and then change your css to:
.top_nav ul li.current a {
color: #111; background: #fff;
}

Can't see link unless you hover over link?

I'm having an issue on my site http://noahsdad.com; if you look at the widget I installed at the very bottom, you can't see the links unless you hover over them. This doesn't just happen with this widget, almost any I put in have a 'haze' over them, if that makes sense.
I'm wondering if someone could help me figure out what's going on, and how to correct it.
Thanks.
The links are visible, they are just set to a light grey colour. You have these rules defined in your default.css file:
a:link, a:visited {
color: #EEEEEE;
}
a:hover {
color: #999999;
}
You could change the value of the standard link colour, or you create a new rule with a higher specitivity, so that only links in that widget are affected.
#dsq-combo-widget a {
color: #999;
}
Update
You haven't specified the color for your new style:
.widget ul li a:link, .widget ul li a:visited {
display: block;
text-decoration: none;
color: #999; <-- Add this
}
Only because of color you can't see it but it's visible. You have a predefined color (#EEE) for all of your "a:link, a:visited" at "http://yourdomain.com/wp-content/themes/ProPhoto_10/style.css" at line 3 and all links are inheriting that color so if you want to change the color for your widgets then add another color like
.widget ul li a:link, .widget ul li a:visited {
display: block;
text-decoration: none;
color: #333; /*or whatever you want*/
}
It's at line 345 in the same file.

Resources