My webpage's code was created through the use of Wordpress.
<div class="header-main">
<h1 class="site-title"><a href="http://wp-themes.com/" rel="home">Theme Preview</a></h1>
<div class="search-toggle active">
<a href="#search-container" class="screen-reader-text">Search</a>
</div>
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<h1 class="menu-toggle">Primary Menu</h1>
<a class="screen-reader-text skip-link" href="#content">Skip to content</a>
<div class="nav-menu"><ul><li class="page_item page-item-2"><a href="http://wp-themes.com/?page_id=2">About</a></li><li class="page_item page-item-46 page_item_has_children"><a href="http://wp-themes.com/?page_id=46">Parent Page</a><ul class="children"><li class="page_item page-item-49"><a href="http://wp-themes.com/?page_id=49">Sub-page</a></li></ul></li></ul></div>
</nav>
</div>
In an attempt to hide all elements except those with .page-item-2
, I implemented the following CSS:
.header-main .nav-menu li:not(.page-item-2) {
display:none;
}
This solution effectively hides unwanted elements, but I also wish to exclude .page-item-46
from the selector. My modified CSS rule looks like:
.header-main .nav-menu li:not(.page-item-2) :not(.page-item-46) {
display:none;
}
Unfortunately, this adjustment does not produce the desired outcome.