在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ min-width與margin的關(guān)系?

min-width與margin的關(guān)系?

最近遇到一個這樣的場景,不知道其中的原理,希望會的大神能幫小白解答一下,謝謝

<style>

.wraper{
  background: red;
  min-width: 50px;
  display: flex;
  height:200px;
  line-height: 200px;
  width: 500px;
  color:#fff;
  margin:10px auto;
}
.desc{
  flex:1;
  background: #000;
}
.arrow{
  background: green;
  margin-right: 10px
}
.arrow1{
  background: green;
  margin-right: -10px
}
.wraper-item{
  min-width: 100px;
}

</style>
<div class="wraper">

<span class="desc">圖標(biāo)容器的 => margin-right:10px</span>
<div class="wraper-item">
  <span class="title">錫林郭勒盟</span>
  <span class="arrow">圖標(biāo)</span>
</div>

</div>
<div class="wraper">

<span class="desc">圖標(biāo)容器的 => margin-right:-10px</span>
<div class="wraper-item">
  <span class="title">錫林郭勒盟</span>
  <span class="arrow1">圖標(biāo)</span>
</div>

</div>

clipboard.png

問題就是 紅色的div我設(shè)置了min-width,但是為啥margin-right為負(fù)值的時候,紅色的div未能將其包裹,而正值的時候卻能將其包裹,這是什么原理?

回答
編輯回答
編輯回答
怣人

正值的時候圖標(biāo)離右邊邊框10px,負(fù)值的時候會超出右邊邊框10px;一來一回差20px。

2017年10月29日 05:25