- This topic has 21 replies, 3 voices, and was last updated 8 years, 3 months ago by
Sakin.
-
AuthorPosts
-
April 24, 2014 at 4:58 am #27174
Djapeto
MemberIs it possible to add image before text in menu. I tried with this code:
.download a{
padding-left: 30px !important;
background-image: url(images/ciklama.jpg);
background-position: left;
background-repeat: no-repeat;
}where “download” is name of class of menu item (CSS optional)
Tesxt of “Download” link is moved right but there is no image
pls visit:
http://demo.raznirecepti.com/demo/April 24, 2014 at 11:54 am #27210April 24, 2014 at 2:16 pm #27231Djapeto
Memberthis is full path:
0:/demo/wp-content/themes/catch/kathmandu/imagesand this is css:
.download a{
padding-left: 100px !important;
background-image: url(“‘demo/wp-content/themes/catch-kathmandu/images/ciklama.jpg);
background-position: left;
background-repeat: no-repeat;
}I tried with path:
url(“‘wp-content/themes/catch-kathmandu/images/ciklama.jpg) but nothing happensApril 24, 2014 at 2:20 pm #27235Sakin
Keymaster@Djapeto: You are not supposed to edit any core theme file or add anything in core theme folder. As this folder will be reverted back when you update the theme. You can simply upload the image from “Media => Add New” from your WordPress dashboard and then send me the image url.
April 24, 2014 at 6:53 pm #27271Djapeto
MemberOk. I followed your instruction and I got this file-/image url:
http://demo.raznirecepti.com/demo/wp-content/uploads/2014/04/ciklama.jpg
Thanks!
April 24, 2014 at 6:58 pm #27273Sakin
Keymaster@Djapeto: Remove your custom css and add the following css in “Appearance => Theme Options => Custom CSS” box.
#header-menu .download a { background: url("http://demo.raznirecepti.com/demo/wp-content/uploads/2014/04/ciklama.jpg") no-repeat scroll left center transparent; padding-left: 25px !important; }
April 24, 2014 at 8:08 pm #27284Djapeto
MemberThank you a lot Sakin, it’s working now. One question more.
How to keep Text “Download” visible because on hover text link disappear? Also, when I use same logic for sub menu items it seems that sub menu items are transparent. I wish to keep them with default background color.
April 24, 2014 at 9:27 pm #27297Sakin
Keymaster@Djapeto: Sorry i forgot that there is background color. Just replace previous css with the following.
#header-menu .download a { background-image: url("http://demo.raznirecepti.com/demo/wp-content/uploads/2014/04/ciklama.jpg"); background-position: left center; background-repeat: no-repeat; padding-left: 25px; }
April 28, 2014 at 12:43 am #27820Djapeto
MemberThank you Sakin! Sorry for late reply. I put small icons in front of submenu text
http://demo.raznirecepti.com/demoHow to avoid issue that icon from primary menu override all my submenu icons?
Can I decrease somehow width of submenu? Default width is 205px but when I try to change this value in css nothing happens.
April 28, 2014 at 3:19 am #27841Djapeto
MemberIf you turn off background image in link “Skupstine stanara” you will see all icons of submenu items.
April 28, 2014 at 3:47 am #27850Sakin
Keymaster@Djapeto: I see that you have background in the main menu as
#header-menu .users_icon a { }
But then for sub-menus you added in like
#header-menu .seboj a { }
But instead it should be as
#header-menu .users_icon .seboj a { }
April 30, 2014 at 1:50 pm #28224Djapeto
MemberOk. Thanks. I put !important at the end of url and got the same effect:
url(“http://demo.raznirecepti.com/demo/wp-content/uploads/2014/04/ciklama.png”) !important;
Can I decrease somehow width of submenu? Default width is 205px but when I try to change this value in css nothing happens.
rgds,
DjapetoApril 30, 2014 at 10:10 pm #28278Sakin
Keymaster@Djapeto: You should change the width of both. I have make it smaller. Add the following css.
.header-sidebar .widget ul.menu ul { width: 169px; } .header-sidebar .widget ul.menu ul a { width: 105px; }
May 5, 2014 at 3:13 am #28983Djapeto
MemberThanks!
June 17, 2014 at 4:13 am #35026Djapeto
MemberHi,
I follow your instrucions but I have problem with two submenu items
Suncokret A and Suncokret B. The icons for these two items are same as parent menu item icon (main menu – Skupstine stanara)Please advice what to do!
http://www.firstfacility-belville.net/
regards,
DjapetoJune 17, 2014 at 10:50 am #35051Sakin
KeymasterHi Djapeto,
First there is issue with your custom CSS. Please remove the following line
/*end */}
Then you have added image attachment page URL. But you are supposed to add in image url. See your css:
#header-menu .users_icon .suncokret a { background-image: url("http://www.firstfacility-belville.net/?p=291") !important; background-position: 6px; background-repeat: no-repeat; padding-left: 45px; }
http://www.firstfacility-belville.net/?p=291
is image attachment page URL where ashttp://www.firstfacility-belville.net/wp-content/uploads/2014/04/suncokret.png
is your image URL. So, try replacing the your above css with the following:#header-menu .users_icon .suncokret a { background-image: url("http://www.firstfacility-belville.net/wp-content/uploads/2014/04/suncokret.png"); background-position: 6px; background-repeat: no-repeat; padding-left: 45px; }
May 25, 2016 at 10:21 pm #92300Huca
ParticipantHi,
I am trying to add image to my menu on this page:
by using the code
`#header-menu .home a {
background-image: url(“http://solveprague.cz/wp-content/uploads/2016/05/logoSP2525.jpg”);
background-position: left center;
background-repeat: no-repeat;
padding-left: 25px;
}tbh I am not really sure where to change name of class menu item. I have changed it in atribute title to “home”.
thanks for your help.
May 25, 2016 at 11:38 pm #92304Sakin
Keymastertry using
.nav-primary .menu-item-1502 a { }
May 26, 2016 at 2:01 pm #92353Huca
ParticipantThanks a lot it works!
One more question – any idea, how to set just a tiny left margin for the image itself so it would be exactly on the left side? When being on this particular page the menu is ugly. However all the margins and padding apply for text only, not for image.
May 26, 2016 at 4:49 pm #92360 -
AuthorPosts
- The topic ‘add image-icon before text in menu’ is closed to new replies.