Note that there are some explanatory texts on larger screens.

plurals
  1. PODrop-down menus and the <li> tag
    primarykey
    data
    text
    <p>I am modifying the CSS of an existing web page. The navigation menu is in the form of a list in which the items have a certain background color under normal circumstances and another color when active or hovered-over. The CSS code for this is as follows: </p> <pre class="lang-css prettyprint-override"><code>#navigation li a:hover, #navigation li#active a { background: #104E91; } </code></pre> <p>Some of the menu items (list items, in this case) have drop-down menus with links to sub-pages. I'm trying to make the navigation menu items have the "active" background color not only if they are themselves active, but also if one of their sub-pages is open. Is there any way to implement this? The code for the drop-down menus looks as follows:</p> <pre class="lang-css prettyprint-override"><code>#wsite-menus .wsite-menu li:first-child { border-top: 1px solid #000; } #wsite-menus .wsite-menu li a { padding: 8px; color: #fff; background: #2f2f2f; border: 1px solid #4b4b4b; border-top: none; } #wsite-menus .wsite-menu li a:hover { background: #4b4b4b; } </code></pre> <p>I suspect that the way to bring this about would be to modify the first of the two above blocks of code to read as follows:</p> <pre class="lang-css prettyprint-override"><code>#navigation li a:hover, **#navigation li#active child,** #navigation li#active a { background: #104E91; } </code></pre> <p>or something similar, but I can't figure out the exact syntax. Is there a way an open child page can make the parent page look active in the navigation menu?</p> <p>The HTML is as follows:</p> <pre><code>&lt;div id = "navigation"&gt; &lt;ul class = "wsite-menu-default"&gt; &lt;span id = "Span1" class = "wsite-nav-handle"&gt; style="display: inline;"&gt; &lt;li class="w-menu-item wsite-nav-0" style="position: relative;"&gt; </code></pre> <p>... and so on, there are a number of list items. I guess I should create a separate span that imparts an active background color to a list item, and, on each child page, put that span around the list item that is responsible for the page's parent's menu item.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload