Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I create two li styles?
    text
    copied!<p>I have created a li ul menu and it's working perfectly. However, I want the last li in the code below to have a different background.</p> <p>I've tried adding style="background-color:#F00" to the li in question, but it doesn't work.</p> <p>Does anyone know how this can be done? </p> <p>Thanks in advance,</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; #cssmenu { background:#a8ac9d; width: 270PX; } #cssmenu &gt; ul { padding:1px 0; margin:0px; list-style:none; width:270px; height:21px; font:normal 8pt verdana, arial, helvetica; } #cssmenu &gt; ul li { margin:0; padding:0; display:block; float:left; position:relative; width:270px; } #cssmenu &gt; ul li a:link, #cssmenu &gt; ul li a:visited { padding:4px 0; display:block; text-align:center; text-decoration:none; background:#a8ac9d; color:#ffffff; width:270px; height:13px; } #cssmenu &gt; ul li:hover a, #cssmenu &gt; ul li a:hover, #cssmenu &gt; ul li a:active { padding:4px 0; display:block; text-align:center; text-decoration:none; background:#a8ac9d; color:#ffffff; width:270px; height:13px; } #cssmenu &gt; ul li ul { margin:0; padding:0px 0px 0; list-style:none; display:none; background:#a8ac9d; width:270px; position:absolute; top:21px; left:0px; } #cssmenu &gt; ul li:hover ul { display:block; width: 270PX; } #cssmenu &gt; ul li ul li { width:146px; clear:left; width:270px; } #cssmenu &gt; ul li ul li a:link, #cssmenu &gt; ul li ul li a:visited { clear:left; padding:4px 0; width:270px; position:relative; z-index:1000; } #cssmenu &gt; ul li ul li:hover a, #cssmenu &gt; ul li ul li a:active, #cssmenu &gt; ul li ul li a:hover { clear:left; background:#a8ac9d; padding:4px 0; width:270px; position:relative; z-index:1000; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id='cssmenu'&gt; &lt;ul&gt; &lt;li&gt;&lt;a href='#'&gt;&lt;span&gt;Products&lt;/span&gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href='#'&gt;&lt;span&gt;Product 1&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li style="background-color="#F00"&gt;&lt;a href='#'&gt;Product 2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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