简体   繁体   中英

How to make a DIV container that DOES NOT shrink/expand according to its text inside?

basically I want to make a button using a div container. It's a play/pause button, the symbol I use inside the button is bold "ll" for pause and the symbol "►" for play.

However when I switch the symbols with javascript inside the button. the width of the div also changes. As the symbol "►" is a little wider than the bold "ll".

So how can I make the div with a fixed width, so that the "div-box" does not shrink nor expand?

Thanks!

Got it fixed, actually display:inline-block; works but not for all browsers. I ended up finding a good solution which is to use <button> , which by itself is a inline div and you can modify it's dimensions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM