爱编程的设计师 2022-05-24 21:47 采纳率: 94.4%
浏览 73
已结题

css中的button里面的文字上下边距不一样怎么调整成一样

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

img

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .home{
            margin: 100px auto;
            width: 500px;
            height: 650px;
            /* background-color: rgb(250, 59, 59); */
        }
        .main_top{
            width: 100%;
            height: 380px;
            background-color: rgb(58, 58, 58);
            border-radius: 20px 20px 0px 0px;
            overflow: hidden;
        }
        .main_top .item{
            width: 100%;
            height: 35px;
            margin-bottom: 20px;
            /* background-color: blue; */
        }
        .main_top .item button{
            float: left;
            width: 45px;
            height: 31px;
            margin-right: 13px;
            border-radius: 4px;
            border-style: solid 1px rgb(237, 237, 237);
        }
        .main_top  .one{
            margin-top: 80px;
            /* margin-left: 40px; */
        }
        .main_top .item :nth-child(1){
            margin-left: 55px;
        }
        .main_top .item :nth-child(3){
            margin-right: 30px;
        }
        .main_top .item div{
            float: left;
            width: 200px;
            height: 31px;
            background-color:rgb(23, 23, 23) ;
            border-radius: 3px;
            /* padding-left: 12px; */
        }

        .main_top .item div span{
            line-height: 31px;
            font-size: 10px;
            color: rgb(192, 192, 192);
        }
        .main_buttom{
            box-sizing: border-box;
            width: 100%;
            height: 150px;
            padding-top: 25px;
            padding-left: 55px;
            background-color: rgb(23, 23, 23);
            border-radius: 0px 0px 20px 20px;
            color: rgb(200, 200, 200);
            font-size: 14px;
        }
        .main_buttom div button{
            display: inline-block;
            box-sizing: border-box;
            padding: 0px;
            width: 22px;
            height: 16px;
        }
    </style>
</head>
<body>
    <div class="main">
        <div class="home">
            <div class="main_top">
                <div class="item one">
                    <button>-</button>
                    <button>0</button>
                    <button>+</button>
                    <div>
                        <span class="price">单价:12.5元</span>
                        <span class="total">小计:0元</span>
                    </div>
                </div>
                <div class="item two">
                    <button>-</button>
                    <button>0</button>
                    <button>+</button>
                    <div>
                        <span class="price">单价:12.5元</span>
                        <span class="total">小计:0元</span>
                    </div>
                </div>
                <div class="item three">
                    <button>-</button>
                    <button>0</button>
                    <button>+</button>
                    <div>
                        <span class="price">单价:12.5元</span>
                        <span class="total">小计:0元</span>
                    </div>
                </div>
                <div class="item four">
                    <button>-</button>
                    <button>0</button>
                    <button>+</button>
                    <div>
                        <span class="price">单价:12.5元</span>
                        <span class="total">小计:0元</span>
                    </div>
                </div>
                <div class="item five">
                    <button>-</button>
                    <button>0</button>
                    <button>+</button>
                    <div>
                        <span class="price">单价:12.5元</span>
                        <span class="total">小计:0元</span>
                    </div>
                </div>
            </div>
            <div class="main_buttom">
                <div class="top">
                    <span>商品合计:</span>
                    <button>0</button>
                    <span></span>
                    <span>共花费了:</span>
                    <button>0</button>
                    <span></span>
                </div>
                <div class="buttom">
                    <span>其中最贵的商品单价是:</span>
                    <button>0</button>
                    <span></span>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

  • 写回答

2条回答 默认 最新

  • 你好!机器人 2022-05-24 21:58
    关注

    .main_buttom div button{border:none} 加一个

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 6月3日
  • 已采纳回答 5月26日
  • 修改了问题 5月24日
  • 创建了问题 5月24日

悬赏问题

  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?