简体   繁体   English

的按钮 <input> 字体大小太小时上升

[英]Button for <input> goes up when the font-size is too small

I'm trying to make a to-do list, but the button always goes a bit up whenever I make the text smaller. 我正在尝试做一个待办事项清单,但是每当我缩小文字范围时,按钮总是会向上移动。 Any help? 有什么帮助吗?

 * { margin: 0; padding: 0; } input:first-letter { text-transform: capitalize; } input { height: 19px; margin-top: 20px; background-color: #222222; border: 0px; color: white; text-align: center; height: 50px; width: 299px; font-size: 20px; } button { height: 52px; width: 51px; font-size: 40px; background-color: #0095FF; border: 0px; color: white; } button:hover { background-color: #0077FF; } #output { background-color: #EEEEEE; width: 350px; height: 600px; } 
 <form id="form"> <input id="input" placeholder="To-Do List"></input> <!-- --> <button id="+">+</button> </form> <div id="output"></div> 

And if possible, could you please tell me how I could automatically capitalize the first letter of the input without any external libraries? 并且,如果可以的话,请您告诉我如何在没有任何外部库的情况下自动将输入的首字母大写?

Thanks. 谢谢。

 * { margin: 0; padding: 0; } input:first-letter { text-transform: capitalize; } input { height: 19px; background-color: #222222; border: 0px; color: white; text-align: center; height: 50px; width: 299px; font-size: 20px; text-transform:capitalize; } button { height: 50px; width: 51px; font-size: 35px; background-color: #0095FF; border: 0px; color: white; } button:hover { background-color: #0077FF; } #output { background-color: #EEEEEE; width: 350px; height: 600px; } .form-1 { float: left; } .form { float: left; } 
 <form id="form"> <div class="form-1"> <input id="input" placeholder="To-Do List"></input></div> <!-- --> <div class="form"> <button id="+">+</button></div> </form> <div id="output"></div> 

change height of button 改变按钮的高度

button {
    height: 50px;}

add float and remove margin-top of iput 添加浮点并删除iput的margin-top

input {
/* margin-top: 20px; */
float: left;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM