简体   繁体   English

HTML CSS DIV 面板

[英]HTML CSS DIV Panels

I want to make something like this:我想做这样的事情:在此处输入图片说明

What I do so far:到目前为止我所做的:

在此处输入图片说明

Can anyone tell me how I achieve this...谁能告诉我我是如何做到这一点的...

Thanks!谢谢! In Advance...提前...

See jsFiddlejsFiddle


Code Is As Follows:代码如下:

HTML : HTML :

<div class="panel panel1">Panel 1x</div>
<div class="panel panel1">Panel 1x</div>
<br>
<div class="panel panel2">Panel 2x</div>

CSS : CSS :

body {
    background: #eeeeee;
}
.panel {
    display: inline-block;
    background: #ffffff;
    min-height: 100px;
    height: 100px;
    box-shadow:0px 0px 5px 5px #C9C9C9;
    -webkit-box-shadow:2px 2px 5px 5x #C9C9C9;
    -moz-box-shadow:2px 2px 5px 5px #C9C9C9;
    margin: 10px;
    padding: 10px;
}
.panel1 {
    min-width: 100px;
    width: 100px;
}
.panel2 {
    min-width: 245px;
    width: 245px;
}

See: jsFiddle参见: 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>

Make the height of the div to the right smaller than the left one, and have no margin on top/bottom.使右侧的 div 高度小于左侧的高度,并且顶部/底部没有边距。 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>

使用像https://simplegrid.io/这样的网格,使用网格系统比花费一生摆弄 CSS 要好得多,尤其是考虑到你想出的任何代码将来都可能会崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM