css - Max width with twitter bootstrap label -


i trying achieve similar thing tags.

it looks great, problem want have maximum width of each tag, if length of the tag, big, truncated.

i can achieve with:

.label{     width: 50px;         float: left;         overflow: hidden;   } 

ok, works, when this, number not on same line label.

how can achieve same effect on first fiddle, maximum width.

this should trick:

.label {     display: inline-block;     max-width: 100px;     overflow: hidden;     text-overflow: ellipsis;     white-space: nowrap;     vertical-align: middle; } 

jsfiddle demo.

what i've done here dropped float: left , replaced display: inline-block. i've given ellipsis text-overflow property make nicer, , set vertical-align middle in line .multiple element. oh, , i've replaced width max-width stop smaller tags being same size.

example usage

here example multiple tags (each on new line intentionally): jsfiddle.

example

obviously can adjust max-width accordingly.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -