如何防止按钮使用长文本调整大小? [英] How to prevent button to resize with long text ?

查看:65
本文介绍了如何防止按钮使用长文本调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个按钮1.添加为朋友和2.发送请求但这些按钮大小根据其文本而变化。我想在朋友请求发送按钮中显示文本,像Facebook一样的朋友请求....怎么做 ?我正在使用bootstrap



我尝试了什么:



I have two buttons 1. add as friend and 2.friend Request sent but these button size are change according to their text. I want to display text in "friend Request sent" button to "Friend Req...." like facebook ! how to do that ? I am using bootstrap

What I have tried:



< button type =buttonid =friend_btnclass =btn btn-frm btn-success dropdown-toggledata-toggle =dropdown aria-haspopup =truearia-expanded =false>

加为好友

< / button>


<button type="button" id="friend_btn" class="btn btn-frm btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Add as Friend
</button>

推荐答案

为防止按钮调整大小,您必须设置所需的大小,否则它将自动... 。

To prevent a button from resizing you have to set the desired size, otherwise it will be auto...
<button style="widht: 30px;">Long text in button</button>



使一些文字结束使用省略号,您应该使用文本溢出 [ ^ ]但是在某些浏览器中存在一些问题,所以你应该将文本包装好跨度......


To make some text ending with ellipsis you should use text-overflow[^] of CSS...However it has some problems in some browsers so you should wrap the text in a span...

<button style="widht: 30px;"><span style="text-overflow:ellipsis;">Long text in button</span></button>


这篇关于如何防止按钮使用长文本调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆