0
項目:lightertaste.com中心子菜單下一級菜單
試圖居中我的子菜單項在我的主導航欄父菜單項下。每個之前的向上箭頭以及菜單本身應該完全集中在它們的父菜單文本上。
/*
Site Navigation
----------------------------------------------------------------------------- */
.genesis-nav-menu {
\t clear: both;
\t text-align: right;
}
.genesis-nav-menu .menu-item {
\t display: inline-block;
}
.genesis-nav-menu a {
\t display: inline-block;
\t position: relative;
\t padding: 0px 10px;
\t font-family: 'dosis-regular';
\t color: #3d4646 !important;
\t font-size: 21px;
\t letter-spacing: 1px;
\t font-weight: 500;
\t text-decoration: none;
\t text-transform: lowercase;
}
.genesis-nav-menu a:hover {
\t color: #68a29c !important;
}
/* Sub Navigation
--------------------------------------------- */
.menu-primary li{
\t position: relative;
}
.genesis-nav-menu .menu-item:hover > .sub-menu,
.genesis-nav-menu .menu-item:focus > .sub-menu,
.genesis-nav-menu .menu-item.menu-item-hover > .sub-menu {
\t left: auto;
}
.genesis-nav-menu .sub-menu:before {
\t content: '';
\t display: block;
\t margin: auto;
\t width: 0;
\t height: 0;
\t border-left: 10px solid transparent;
\t border-right: 10px solid transparent;
\t border-bottom: 10px solid #3d4646;
}
.genesis-nav-menu .sub-menu {
\t z-index: 1000;
\t left: -9999px;
\t display: block;
\t position: absolute;
\t width: 150px;
}
.genesis-nav-menu .sub-menu a {
\t width: 150px;
\t padding: 10px;
\t background-color: #3d4646;
\t color: #ffffff !important;
\t font-size: 12px;
\t font-weight: normal! important;
\t text-align: center;
}
.genesis-nav-menu .sub-menu a:hover {
\t background-color: #68a29c;
\t color: #3d4646 !important;
}
<section id="nav_menu-2" class="widget widget_nav_menu"><div class="widget-wrap"><nav class="nav-header" itemscope itemtype="http://schema.org/SiteNavigationElement"><ul id="menu-main" class="menu genesis-nav-menu"><li id="menu-item-281" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-281"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Appetizers & Snacks</span></a>
<ul class="sub-menu">
\t <li id="menu-item-297" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-297"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Dips & Spreads</span></a></li>
\t <li id="menu-item-389" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-389"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Meat & Fish</span></a></li>
\t <li id="menu-item-390" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-390"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Fruits & Vegetables</span></a></li>
</ul>
</li>
<li id="menu-item-119" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-119"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Breakfast</span></a>
<ul class="sub-menu">
\t <li id="menu-item-299" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-299"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Eggs & Omelettes</span></a></li>
\t <li id="menu-item-298" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-298"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Pancakes & Waffles</span></a></li>
\t <li id="menu-item-260" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-260"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Oatmeal & Granola</span></a></li>
\t <li id="menu-item-259" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-259"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Breads, Muffins, & Pastries</span></a></li>
\t <li id="menu-item-261" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-261"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Shakes & Smoothies</span></a></li>
</ul>
</li>
<li id="menu-item-120" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-120"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Lunch</span></a>
<ul class="sub-menu">
\t <li id="menu-item-258" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-258"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Sandwiches & Wraps</span></a></li>
\t <li id="menu-item-262" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-262"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Salads & Power Bowls</span></a></li>
\t <li id="menu-item-263" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-263"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Soups & Stews</span></a></li>
</ul>
</li>
<li id="menu-item-121" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-121"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Dinner</span></a>
<ul class="sub-menu">
\t <li id="menu-item-279" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-279"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Quick & Easy</span></a></li>
\t <li id="menu-item-278" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-278"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Beef & Pork</span></a></li>
\t <li id="menu-item-276" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-276"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Chicken & Poultry</span></a></li>
\t <li id="menu-item-277" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-277"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Seafood & Shellfish</span></a></li>
\t <li id="menu-item-273" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-273"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Casseroles & One-Pans</span></a></li>
\t <li id="menu-item-274" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-274"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Pastas & Risottos</span></a></li>
\t <li id="menu-item-275" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-275"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Pizzas & Flatbreads</span></a></li>
</ul>
</li>
<li id="menu-item-124" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-124"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Desserts</span></a>
<ul class="sub-menu">
\t <li id="menu-item-264" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-264"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Cakes & Pies</span></a></li>
\t <li id="menu-item-265" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-265"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Cookies & Brownies</span></a></li>
\t <li id="menu-item-288" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-288"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Ice Creams & Sorbets</span></a></li>
</ul>
</li>
<li id="menu-item-123" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-123"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Sides</span></a>
<ul class="sub-menu">
\t <li id="menu-item-392" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-392"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Vegetables & Potatoes</span></a></li>
\t <li id="menu-item-391" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-391"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Rice & Noodles</span></a></li>
\t <li id="menu-item-122" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-122"><a href="http://www.lightertaste.com/sample-page/" itemprop="url"><span itemprop="name">Breads & Rolls</span></a></li>
</ul>
</li>
</ul></nav></div></section>
謝謝!我省略了下面列出的代碼,並且沒有對HTML進行任何更改,但現在它正在工作。謝謝!! .widget {max-width:1200px; padding:0 15px; margin:0 auto;} – Samantha