Make buttons the same width in AngularJS -
in angularjs app, whenever ng-repeat
produces this:
<div> <button>alice</button> </div> <div> <button>bob</button> </div> <div> <button>jennifer</button> </div>
i buttons have same width, width of whichever button widest, determined length of caption contains. can done pure angularjs, , without importing jquery this?
making buttons same width 1 longest caption, don't need javascript nor angularjs, css.
html
<div class="container"> <button type="button">some button</button> <button type="button">button here, too...</button> <button type="button">yet another</button> </div> <!-- or using ng-repeat e.g. --> <div class="container"> <span ng-repeat="button in buttons"> <button type="button" ng-bind="button"></button> </span> </div>
css
.container { position: absolute; } .container button { display: block; width: 100%; margin: 2px; text-align: center; }
screenshot
related plunker here https://plnkr.co/edit/tnnwmd
Comments
Post a Comment