Div does not want to align to center..
-
Hi Guys,
After 4 hours of not achieving anything, I hope you can help me…
This is the code in a theme template (header). It is a responsive menu that is aligned on the left (nav id=”main-nav” class=”primary menu center”.
I want it aligned to the center.
<header id="header" class="container span-12 "> <h1 id="logo" class="center"> <a href="https://maasbergbv.nl/website/" title="Maasberg BV" rel="home">Maasberg BV</a> </h1> <div id="menu3"><div id="menu2"><nav id="main-nav" class="primary menu center"> <ul id="menu-responsive-select-menu" class="menu"><li id="menu-item-6682" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-6682"><a href="https://www.madza-wordpress-premium-themes.com/wp-donatenow/">Home</a></li> <li id="menu-item-6705" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-6705"><a href="https://maasbergbv.nl/website/?page_id=6029" class="w-sub">Blog</a> <ul class="sub-menu" style="display: none;"> <li id="menu-item-7066" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-7066"><a href="https://maasbergbv.nl/website/?cat=1">Geen categorie</a></li> </ul> </li> <li id="menu-item-6708" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-6708"><a href="https://maasbergbv.nl/website/?page_id=4900">Portfolio</a></li> <li id="menu-item-6707" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-6707"><a href="https://maasbergbv.nl/website/?page_id=4975">Contacts</a></li> </ul><select class="select-menu"><option value="#">Navigate to...</option><option value="https://www.madza-wordpress-premium-themes.com/wp-donatenow/"> Home</option><option value="https://maasbergbv.nl/website/?page_id=6029"> Blog</option><option value="https://maasbergbv.nl/website/?cat=1">– Geen categorie</option><option value="https://maasbergbv.nl/website/?page_id=4900"> Portfolio</option><option value="https://maasbergbv.nl/website/?page_id=4975"> Contacts</option><option value="#">Navigate to...</option><option value="https://www.madza-wordpress-premium-themes.com/wp-donatenow/"> Home</option><option value="https://maasbergbv.nl/website/?page_id=6029"> Blog</option><option value="https://maasbergbv.nl/website/?page_id=4900"> Portfolio</option><option value="https://maasbergbv.nl/website/?page_id=4975"> Contacts</option></select> </nav></div></div> </header>
The CSS is here:
.menu li { display: inline; float: center; } #menu3 {width:100%;} #menu2 {float: center; position: relative; width: 100%; margin-right: 50%; background-color: #fff; max-width: 700px;} .menu.tertiary li, .menu.secondary li { margin-right: 8px; padding-right: 8px; } .menu.tertiary li:last-child, .menu.secondary li:last-child { margin-right: 0; padding-right: 0; border-right: none; } .menu.tertiary li .sub-menu, .menu.secondary li .sub-menu { display: none; } .menu.tertiary li { border-right: 1px solid rgba(255, 255, 255, 0.2); } .menu.secondary li { border-right: 1px solid rgba(0, 0, 0, 0.2); } .select-menu { display: none; } #main-nav { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; } #main-nav ul { line-height: 1; float: center; display: block; } #main-nav ul li { float: left; color: #ffffff; background-color:#ba0808; } #main-nav ul li { position: relative; display: block; font-size: 12px; font-weight: bold; text-transform: uppercase; } #main-nav ul li a { display: block; outline: none; cursor: default; } #main-nav ul li a[href] { cursor: pointer; margin-top:15px; } #main-nav ul li.menu-item-hover > a, #main-nav ul li.current-menu-item > a { color: #ffffff; background-color:#ba0808; } #main-nav ul.sub-menu { display: none; position: absolute; width: 180px; left: 10px; margin-top: 0px; border-top: 2px solid #ffa01f; -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2); -moz-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2); box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2); z-index: 300; background-color: #fff; } #main-nav ul.sub-menu li { position: relative; width: 100%; font-size: 12px; line-height: 14px; padding: 0; border-top: 1px solid #eaeaea; font-weight: normal; text-transform: none; } #main-nav ul.sub-menu li a { background-color: transparent; padding: 10px 10px; } #main-nav ul.sub-menu li a:hover { background-color: rgba(0, 0, 0, 0.02); } #main-nav ul.sub-menu li a.w-sub:after { font-family: 'fontello'; font-style: normal; font-weight: normal; speak: none; display: inline-block; text-decoration: inherit; width: 1em; content: '\61'; position: absolute; right: 0; } #main-nav ul.sub-menu li:first-of-type { position: relative; border-top: none; } #main-nav ul.sub-menu li.menu-item-hover > a, #main-nav ul.sub-menu li.current-menu-item > a { color: #ffa01f; padding: 10px 10px; border-top: none; } #main-nav ul.sub-menu li .sub-menu { top: -2px; left: 180px; } #main-nav ul.sub-menu li .sub-menu li:first-of-type:before { display: none; } /*
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Div does not want to align to center..’ is closed to new replies.