Techemistry Blog

asp:Menu Flicker on Page_Load - Solved

7/13/2015 1:48:00 PM -- Ted Krapf

<p>Have an asp:menu that is flickering on (showing all the sub menus) on page_load and/or post back? &nbsp;Of course you do, because that server control is pretty squirrely. &nbsp; Here's the simple CSS fix that corrects the issue:</p> <p><br /> </p> &lt;style type="text/css"&gt; <br /> /* fixes ugly menu flicker */<br /> .menu ul li ul { display: none; }<br /> .menu ul li { position: relative; &nbsp;float: left; list-style: none; }<br /> .menu ul li ul li { width: 100%; }<br /> &lt;style&gt; <p><br /> </p> <p>I've seen numerous "fixes" for Css menu getting flickering while page post back, but the ones I found never included the 3rd line. &nbsp;If you have sub menus, the 3rd line (.menu ul li ul li) corrects the width and positioning issue.</p> <p><br /> </p> <p>Cheers and happy coding!</p>

[return to articles list]