How can the width of a font style be independently fixed?
P粉502608799
2023-08-13 19:50:49
<p>There is a horizontal menu: </p>
<pre class="brush:php;toolbar:false;"><ul>
<li>Text</li>
<li>Text 2</li>
</ul></pre>
<p>When the user clicks on one of the li's, its font becomes bold. Therefore, the width of the li element will change slightly. As a result, the menu jumps. </p>
<p>How can I fix it so that it is not affected by the text width? </p>
You can use CSS to prevent the li width from changing, as shown below:
This will prevent jumping