html - How align center text in custom buttons? -
i have html
<head> <title>html5 app</title> <link rel="stylesheet" type="text/css" href="css/custom.css"> <link rel="stylesheet" type="text/css" href="css/buttons.css"> </head> <body> <!--estructura --> <div id="botones"> <button class="btn" data-am-type="button">soy un <button></button> <a class="btn" data-am-type="button">soy un <a></a> <div class="btn" data-am-type="button">soy un <div></div> <input class="btn" type="button" value="soy un <input>"> </div> </body>
in < button > , < input >, text align center of button in < > , < div >, text shown top of button. think < button > , < input > inherit property , align text in middle of button.
i see this
and want buttons align text in middle.
the class "btn" this
.btn{ display: inline-block; padding: 4px 12px; /* padding por defecto */ font-size: 16px; /* tamaño fuente por defecto */ line-height: 20px; /* tamaño de linea */ text-align: center; vertical-align: middle; font-family: 'helvetica neue', helvetica, arial, sans-serif; cursor: pointer; height: 80px; background-color: #f5f5f5; /* por si no se ve el gradiente, aunque si lo pruebo en chrome nunca deberia verse este color*/ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); border: 1px solid #cccccc; -webkit-border-radius: 4px; }
any idea?
to vertically-centre text of these elements, set line-height
of element's text equal height
of element, , set box-sizing
border-box
(in order height
of elements same:
.btn { /* other, unchanged, css */ line-height: 80px; /* <- changed */ box-sizing: border-box; /* <- added */ }
obviously cause issues, should text wrap second line.
Comments
Post a Comment