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
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:

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.