我正在尝试创建一个高度为"22px"的按钮,按钮内的文本将垂直对齐在按钮的中心.我尝试了一切,但却找不到怎么做.
如何才能做到这一点?
更新: 这是我的代码:
CSS:
.test1 label {
float: left;
clear: left;
width:31%;
margin-right:-2px;
}
.test1 input {
float:left;
width:69%;
margin-right:-2px;
}
.testbutton {
float:left;
margin-left: 10px;
height: 22px;
line-height: 22px;
text-align:center;
background-color:#fbfbfb;
border:1px solid #b7b7b7;
color:#606060;
cursor:pointer;
display:inline-block;
font:bold 12px/100% Arial, sans-serif;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div class="test1">
<label for="test" title="test">test</label>
<input style="width:18px; float:left;" type="checkbox" name="test" id="test" tabindex="5" />
<input class="testbutton" id="testbutton" style="width:60px;"type="button" value="Import" /></div>
Run Code Online (Sandbox Code Playgroud) 我这里有棘手的问题.我想在一个按钮内垂直对齐我的文字
<button id="rock" onClick="choose(1)">Rock</button>
Run Code Online (Sandbox Code Playgroud)
这是我的CSS
button {
font-size: 22px;
border: 2px solid #87231C;
border-radius: 100px;
width: 100px;
height: 100px;
color: #FF5A51;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
button:active {
font-size: 22px;
border: 2px solid red;
border-radius: 100px;
width: 100px;
height: 100px;
}
Run Code Online (Sandbox Code Playgroud)
你可以在这里查看http://jsfiddle.net/kA8pp/.我希望文本在底部.非常感谢你!
编辑:我无法解释它,所以这是它的图片http://i.imgur.com/WGKltUa.png :)