Overflow to left instead of right

后端 未结 6 1544
梦毁少年i
梦毁少年i 2020-11-27 04:15

I have a div with overflow:hidden, inside which I show a phone number as the user types it. The text inside the div is aligned to right and incoming characters

6条回答
  •  盖世英雄少女心
    2020-11-27 04:39

    You can do float:right and it will overflow to the left, but in my case I need to center the div if the window is larger than the element, but overflow to the left if the window is smaller. Any thoughts on that?

    I tried playing around with direction:rtl but that doesn't appear to change the overflow of block elements.

    I think the only answer is to float it right, with a div to the right of it that's also floated right, then set the width of the div to the right to half the remaining window space with jquery.

提交回复
热议问题