Skip to content

[css] 第45天 你知道的等高布局有多少种?写出来 #170

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第45天 你知道的等高布局有多少种?写出来

Activity

wenyejie

wenyejie commented on May 31, 2019

@wenyejie

现在肯定是flex咯
我记得以前还有一种方案, padding: 10000px; margin: -10000px大概是这样!
要不然就通过js去控制

cleverboy32

cleverboy32 commented on May 31, 2019

@cleverboy32

flex ;

.wrap > * { height: 100%; }

Vi-jay

Vi-jay commented on Jul 31, 2019

@Vi-jay
  1. flex拉伸
display: flex;
align-items: stretch;
  1. padding margin抵消 然后background-clip默认是border-box所以会在被抵消的位置依然显示背景 造成等高假象
.box,.box2{
    float: left;
    width: 100px;
}
.box {
    background: #cccccc;
    height: 300px;
}
.box2 {
    background: #306eff;
    padding-bottom: 99999px;
    margin-bottom: -99999px;
}
jiamianmao

jiamianmao commented on Aug 10, 2019

@jiamianmao

table 很适合的。

seho-dev

seho-dev commented on Sep 14, 2019

@seho-dev

使用浮动:padding-bottom 9999px margin-bottom -9999px互相抵消,父级清除浮动,即子元素最高的高度就是父盒子最高的高度
使用flex:默认的flex的align配置就是自动填充满父级盒子,设置子元素高度即父元素高度
使用定位:top和bottom都是0,然后撑开父元素的高度;

smile-2008

smile-2008 commented on Nov 6, 2020

@smile-2008

使用浮动:padding-bottom 9999px margin-bottom -9999px互相抵消,父级清除浮动,即子元素最高的高度就是父盒子最高的高度
使用flex:默认的flex的align配置就是自动填充满父级盒子,设置子元素高度即父元素高度
使用定位:top和bottom都是0,然后撑开父元素的高度;

CSLukkun

CSLukkun commented on Mar 12, 2021

@CSLukkun

var a=1;
var b=2;
a = a^b
b= a^b;
a= a^b;
console.log(a,b)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @smile-2008@wenyejie@haizhilin2013@cleverboy32@jiamianmao

        Issue actions

          [css] 第45天 你知道的等高布局有多少种?写出来 · Issue #170 · haizlin/fe-interview