Jiki
V2EX  ›  问与答

[求助] css flex 容器中项目高度计算问题

  •  
  •   Jiki · Oct 29, 2016 · 2812 views
    This topic created in 3481 days ago, the information mentioned may be changed or developed.

    HTML

    <div class="div1">
        <div class="div2">
    		<span class="span1">sapn1</span>
    	</div>
    	<div class="div3">
    		<span class="span4">span4</span>
    	</div>
    </div>
    

    CSS

        .div1{
        	display: flex;
    		width: 1000px;
    		height: 1200px;
    		flex-direction: column;
    	}
    	.div2{
    		flex-basis: 90%;
    	}
    	.div3{
    		height: 400px;
    	}
    

    大家觉得 class 为.div1 .div2的两个 div 高度会是多少?在 chrome 下的实际值分别是875.67px324.33px
    试了一些觉得可能的计算方式,但没有和实际值相符合的,实在不明白 chrome 是怎么计算他们的高度的。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3311 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 00:31 · PVG 08:31 · LAX 17:31 · JFK 20:31
    ♥ Do have faith in what you're doing.