How can the width of a font style be independently fixed?
P粉502608799
P粉502608799 2023-08-13 19:50:49
0
1
445
<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>
P粉502608799
P粉502608799

reply all(1)
P粉225961749

You can use CSS to prevent the li width from changing, as shown below:

ul li {
   width: 150px;
}

This will prevent jumping

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!