Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's probably better to do this with Javascript. That said, it's not impossible to achieve the effect you're looking for with CSS.</p> <p>If your problem is that, when hovering over parts of the menu that aren't <code>li#search</code> but also aren't another menu item, the dropdown search box disappears, you can fix it by making <code>li#search</code> wider. Of course, this might cause trouble if you have a hover effect for all <code>li</code> that you don't want to cover a wider area. The solution to his new problem is to override the <code>li:hover</code> styling for <code>li#search</code>, and apply it instead to a <code>div</code> within <code>li#search</code>:</p> <p>So your <strong>HTML</strong> could be something like this:</p> <pre><code>&lt;li id="search"&gt; &lt;div&gt;Search&lt;/div&gt; &lt;ul&gt; &lt;li&gt; &lt;input type="text placeholder="search"&gt; &lt;input type="submit" value="search"&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>And your <strong>CSS</strong> could be something like this:</p> <pre><code>li:hover, li#search:hover div {background-color:blue;} li#search {width:50px;padding-left:50px;} li#search:hover {background-color:none;} li#search div {width:50px;} li#search &gt; ul {width:100px;} </code></pre> <p>You can adjust these styles to match your own site (I would have done so, but the jsFiddle you posted has too much CSS to weed through). The important thing is that the effective width (width + padding) of <code>li#search</code> matches the width of <code>li#search &gt; ul</code>.</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.
    1. VO
      singulars
      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