jquery mobile button text auto line break

前端 未结 1 1504
-上瘾入骨i
-上瘾入骨i 2021-01-15 18:26

I want that the text in my button makes an automatic line break when it reaches the end of the button. When i us the normal jquery mobile style it truncates my text and plac

相关标签:
1条回答
  • 2021-01-15 19:02

    You can't line break a single word in < CSS3 but there's a new css keyword in CSS3 called word-break that allows you to. This will obviously only work in CSS3 browsers.

    Give your button a css class, if you want this to only apply to a single button, such as:

    <a data-role="button" class='myButton'>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</a>
    

    Then create a css style like this:

    .myButton
    {
       word-wrap: break-word !important;
       white-space: normal !important;
    }
    

    This will then wrap the word around into the specified width of the button.

    Here's an updated jsFiddle example to demonstrate.

    0 讨论(0)
提交回复
热议问题