Jump to content

aligning text in a button


freelance84

Recommended Posts

I've got a button using css:

#button-submit_1 {
cursor:pointer;
width:80px;
height: 24px;
margin-right:auto;
margin-left:auto;
color:#666666;
text-align: center;
font-size: small;
vertical-align: middle;
background-color: #CCCCCC;
    }

 

But how do i get the text to be vertically in the middle?

Link to comment
https://forums.phpfreaks.com/topic/200326-aligning-text-in-a-button/
Share on other sites

That hasn't worked. The button in the page looks like this:

 

<td><button id="button-submit_1" type="submit">login</button></td>

 

After adding the the new line to the css, it looks like:

#button-submit_1 {
cursor:pointer;
width:80px;
height: 24px;
line-height:24px;
margin-right:auto;
margin-left:auto;
color:#666666;
text-align: center;
font-size: small;
vertical-align: middle;
background-color: #CCCCCC;
    }

 

The 'g' in login on the button touches the bottom of the button and doesn't look very good. I've tried changing loads of settings but i can't get it to lift up.  :confused:

try this, used padding instead of height (hope this works)

 

#button-submit_1 {
  cursor:pointer;
   width:80px;
   margin-right:auto;
   margin-left:auto;
   color:#666666;
   text-align: center;
   font-size: small;
   vertical-align: middle;
   background-color: #CCCCCC;
   padding:2px 0;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.