I am trying to wrap or resize text inside a bootstrap button without resizing the button. I have a few buttons that need to be aligned
I used this class, the text is wrapped, but the button grows in size, affecting the alignment with other buttons
.btn-wrap-text { white-space: normal !important; word-wrap: break-word !important; }
There is sample code, just resize the view: https://jsfiddle.net/mrapi/3yv314dx/1/
thank
Here you will find the solution https://jsfiddle.net/3yv314dx/3/
$('[data-toggle="tooltip"]').tooltip();
.btn-outline { background-color: transparent; color: inherit; transition: all .5s; } .btn-wrap-text { overflow: hidden; white-space: nowrap; display: inline-block; text-overflow: ellipsis; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div class="container"> <div class="row"> <div class="col-sm-6"> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE WITH LONGER NAME </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE WITH LONGER NAME </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline btn-wrap-text" data-toggle="tooltip" title="ARTICLE WITH LONGER NAME"> ARTICLE WITH LONGER NAME </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> <div class="col-sm-4 col-md-4"> <button class="btn btn-success btn-sm btn-block btn-outline"> ARTICLE </button> </div> </div> </div> </div>
, , tooltip
tooltip
, .
.btn css:
.btn
white-space: normal;
, .btn css, :
.btn { white-space: normal; }
, css, inline, :
<button type="button" class="btn btn-primary" style="white-space: normal;">This is some button with text that should wrap</button>
. IE
You can change the font size. If you do not want to change the font size, use the code below
.btn-wrap-text { overflow: hidden; white-space: nowrap; display: inline-block; text-overflow: ellipsis; }
Source: https://habr.com/ru/post/1683345/More articles:How to use space as a field separator using awk? - awkHow to plant a random number generator in an assembly? - assemblyHow to get a list of objects from a task list based on a key or not? - c #Python: How can I stop Threading / Multiprocessing from using 100% of my processor? - pythonPython, Tkinter: как я могу предотвратить сбой tlinter gui mainloop с помощью потоковой передачи - pythontidyr values of individual columns per character and numeric values using regex - regexUse screen.width inside calc (css) - cssHow to set correspondence path with MemoryRouter and Jest? (not place or story) - javascriptNPM installation does not work - fsevents - node.jsSet background image to text? - htmlAll Articles