【问题标题】:What I am do wrong? CSS input type file and submit我做错了什么? CSS 输入类型文件并提交
【发布时间】:2023-03-29 17:51:02
【问题描述】:

我做错了什么?为什么两个按钮不在一条线上?为什么提交按钮的顶部比文件按钮有 1 px 的间隙。

我正在使用 Google Chrome 桌面。在桌面浏览器中,这并不好。在移动 Google chrome 浏览器中,这看起来不错。为什么?我必须用 CSS 写的东西才能在其他浏览器中很好看。

http://jsfiddle.net/uybznk4u/

<input type="file"><input type="submit"value="SUBMIT">

*
{
    margin:0;
    padding:0;
}
input[type=file],input[type=submit]
{
    background:#ff0;
    border:1px solid #f00;
    padding:4px;
    height:20px;
    line-height:20px;
    width:50px;

}
input[type=submit]
{
    height:30px;
    line-height:20px;
}

This is 谢谢。

【问题讨论】:

  • 如果你在谈论左边的间隙,那么你可以使用 margin-left: 5px; 将它们放在一行中用于按钮 css

标签: html css file input submit


【解决方案1】:

只需在第二个按钮上设置垂直对齐:

vertical-align: top

这是更新后的 jsfiddle : http://jsfiddle.net/ddwpw2ej/4/

【讨论】:

    【解决方案2】:
    input[type=file],input[type=submit]
    {
        background:#ff0;
        border:1px solid #f00;
        padding:4px;
        height:20px;
        line-height:20px;
        width:50px;
    
    }
    input[type=submit]
    {
        height:30px;
        line-height:20px;
        vartical-align:top;
    }
    

    试试这个....

    【讨论】:

      猜你喜欢
      • 2013-08-10
      • 2016-02-25
      • 1970-01-01
      • 1970-01-01
      • 2021-05-01
      • 2013-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多