Jump to content

How to make tiny 12px by 12px square buttons?


Recommended Posts

I can make the buttons the right size, but I can't get the plus (+) and minus (-) text to pop into the middle:

 

<html>
<head>
<style type="text/css">
	.SmallButton {
		padding:0px;
		height:12px;
		width:12px;
		font-size:9px;
	} 
    </style>
</head>
<body>
<input type="submit" name="btnWrite" value="+" class="SmallButton">
</body>
</html>

 

 

Try it like this.  You should always make sure you have a document type defined because it will affect the rendering of css, etc...

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

<style>
.SmallButton {
padding:0px;

width:14px;
height:14px;
}

	.SmallButton span {
	font-size:9px;
line-height:10px;
position:relative;
top:-2px;
left:-3px;
}
</style>
</head>
<body>
<button type="submit" name="btnWrite" value="+" class="SmallButton">
<span>+</span>

</button>
</body>
</html>

 

Ahh I see what you are saying.

 

I just tried it out - you're right, the line-height doesn't affect anything with submit buttons. I don't really have a solution for you on this one mate. Sorry. Post back here if you figure something out - I'm curious about it.

if you need it 12x12... why not just set the padding to 6px (all around)?  .. instant 12x12 box (assuming something is in the box)

 

Then you'd decrease the padding.... one pixel at a time to get it just right

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.