Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Single menu background not full width (http://forum.bytesforall.com/showthread.php?t=24016)

Paul Gingell Mar 25, 2018 12:43 PM

Single menu background not full width
 
Hi. I'm remaking an website I built with Atahualpa about 4 years ago and trying to make use of some of the responsive mods suggested on this forum since then. I'm having trouble with the menu background.

I'm trying to set a background which spans all the menu items but doesn't span the full width of the site.

If I target the CSS at div#menu1 ul.rMenu li I get an individual background for each menu item (which doesn't look right because my design uses an inset box shadow around the menu as a whole, not the individual menu items).

Instead, I've used div#menu1 ul.rMenu, but it spans the full width of the layout, unless I set a limiting width value (which causes problems on mobile devices, if fall back fonts are a different size, etc.)

Website: www.cumbria-stone-walling.co.uk

Current CSS:
Code:

div#menu1 ul.rMenu {
        background-color: rgba(135, 135, 135, 0.25) !important;
        -webkit-box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        -moz-box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        -moz-border-radius: 4px;
        -khtml-border-radius: 4px;
        -webkit-border-radius: 4px;
        border-radius: 4px;
        width: 385px;
        height: 40px;
        margin-top: -6px;
        padding: 0px 0px 0px 0px;
        border: solid 1px transparent !important;
}

Is there any way using CSS that I can treat the styling of all menu items as one unit?

Thanks, Paul

juggledad Mar 26, 2018 02:58 AM

Can you provide an export of your Atahualpa settings (ATO->Export/Import) attach the file it creates.

Also do you want the menu background to only be the size of the menu? i.e. on a larg screen, the menu on;y covers a part of the width of the screen, is that how much the background color should cover?

Paul Gingell Mar 26, 2018 03:07 AM

I've solved the issue of wrapping all menu items in a single background by using display: table; which negates the need to specify a width.

Code:

div#menu1 ul.rMenu {
        background-color: rgba(135, 135, 135, 0.25) !important;
        -webkit-box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        -moz-box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.25) inset;
        -moz-border-radius: 4px;
        -khtml-border-radius: 4px;
        -webkit-border-radius: 4px;
        border-radius: 4px;
        /*width: 385px;*/
        /*height: 40px;*/
        margin-top: -6px;
        padding: 0px 14px 0px 0px;
        border: solid 1px transparent !important;
        display: table;
}

This did create an unexpected space under the menu items, which I had to reverse by using margin-bottom: -22px in my menu item CSS. This solution seems to work on both desktop and mobile browsers.

Code:

ul.rMenu-hor li,
ul.rMenu li a:link,
ul.rMenu li a:visited,
ul.rMenu li a:hover,
ul.rMenu li a:active,
ul.rMenu li {
        background: transparent !important;
        border-top: solid 1px transparent !important;
        border-left: solid 1px transparent !important;
        border-bottom: solid 1px transparent !important;
        border-right: solid 1px transparent !important;
        text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3), -1px -1px 0 rgba(0, 0, 0, 0.1);
        padding: 5px 0 5px 8px;
        margin-right: -6px;
        margin-bottom: -22px
}


Paul Gingell Mar 27, 2018 03:58 AM

Hi. Yes the menu wanted to be the size of the menu only. I found a solution using display: table; which seems to work. Whether it's the best solution or just a work-around I don't know.

Some of the exported settings (attached) are redundant from my previous site. I didn't know about the export/import function then, and spent an age reassembling it from various notes I'd made!

Cheers,
Paul

juggledad Mar 27, 2018 01:40 PM

Well there if you have it working, then that is a solution! congratulations.


All times are GMT -6. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.