HTML CSS DIV Panels

前提是你 提交于 2019-12-06 16:03:31
Slugge

Make the height of the div to the right smaller than the left one, and have no margin on top/bottom. This would produce the result you are looking for

body {
  background: #eeeeee;
}
.panel {
  display: inline-block;
  background: #ffffff;
  min-height: 100px;
  height: 100px;
  padding: 10px;
}
.panel1 {
  min-width: 100px;
  width: 100px;
}
.small {
  margin-left: 10px;
  width: 111px;
  height: 90px;
  min-height: 90px;
}
.panel2 {
  min-width: 245px;
  width: 245px;
}
<div class="panel panel1">Panel 1x</div>
<div class="panel panel1 small">Panel 1x</div>
<br>
<div class="panel panel2">Panel 2x</div>
Faisal Awan

See: jsFiddle

Hope you fix this problem:

body {
  background: #eeeeee;
}
.panel {
  display: inline-block;
  background: #ffffff;
  min-height: 100px;
  height: 100px;
  margin: 10px;
  padding: 10px;
}
.panel1 {
  min-width: 100px;
  width: 100px;
  height: 120px;
  margin-bottom: 0;
  box-shadow: 0;
}
.panel2 {
  min-width: 100px;
  width: 100px;
}
.panel3 {
  min-width: 245px;
  width: 245px;
  margin-top: 0px;
}
<div class="panel panel1">Panel 1x</div>
<div class="panel panel2">Panel 1x</div>
<br>
<div class="panel panel3">Panel 2x</div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!