zoukankan      html  css  js  c++  java
  • border占居了宽度,导致子元素在父元素中换行问题解决

    方法一:将border改成outline

    outline是不占据父级空间的

    .chess {
        width : 50px;
        height: 50px;
        outline: 2px solid lightgray;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
    }
    

    方法二: 将盒子设置成border-box

    .chess {
        width : 50px;
        height: 50px;
        border: 2px solid lightgray;
        box-sizing: border-box;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
    }
    
  • 相关阅读:
    2017普及组D1T3 洛谷P3956 棋盘
    2017提高组D1T1 洛谷P3951 小凯的疑惑
    Title
    Title
    Title
    Title
    Title
    Title
    Title
    Title
  • 原文地址:https://www.cnblogs.com/zhizhi0810/p/11624692.html
Copyright © 2011-2022 走看看