Urs*_*Urs 5 css responsive-design twitter-bootstrap zurb-foundation
在理论上,我正在咬牙切齿,看似非常基本的东西.
想想我们每天使用的常规响应网格,如引导程序,基础等......然后将其旋转90度:
灰色容器是具有已知纵横比(3:2)的放大图像.蓝色容器是已知数量的方形图像(拇指),完全适合大图像.粉色边框是容器,已经收到固定高度(如50vh html,body{height:100vh}).所有图像的一侧为100%,一侧为自动.
所以"灰色"图像应该伸展到它的容器,然后拇指应该跟随.真的,经典的RWD行为 - 就在y轴上.
我试过了:
display: table (100%的高度没有踢,并且没有rowpan,试图嵌套它们,可怕)所以回到开头:是否有可能height: 100%, width: auto用纯HTML/CSS 重现这种风格行为?
如果是的话,走哪条路?
如果不是,为什么,你推荐什么作为JS解决方法?
PS我已经尝试过基础的equalizer脚本了:在计算高度时舍入错误.
PPS:我承认我尝试了zurb foundation 6加载的大部分内容(因为我想在页面的其他部分坚持使用它),所以它可能干扰了一些尝试?
小智 0
如上所述,您可以使用填充和高度 0,请阅读这篇文章https://stackoverflow.com/editing-helprticle http://www.mademyday.de/css-height-equals-width-with-pure- css.html,我也做了一个测试,希望是你正在寻找的,查看http://codepen.io/wolfitoXtreme/pen/bEeYep
// CSS
html {
height: 100%;
}
body, body * {
margin: 0;
padding: 0;
height: 100%;
box-sizing: border-box;
}
#container {
margin: 0 auto;
width: 50%;
height: 100%;
display: block;
position: relative;
background-color: #000000;
}
#container #imgMain {
padding-bottom: 75%;
width: 100%;
top: 50%;
left: -25%;
margin-top: -37.5%;
height: 0;
position: absolute;
background-color: #cccccc;
}
#container #imgMain figure {
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
}
#container #imgMain img {
width: 100%;
height: 100%;
display: block;
position: absolute;
}
#container #imgGrid {
top: 0;
right: -50%;
width: 50%;
height: 100%;
position: absolute;
z-index: 10;
background-color: #f0f0f0;
}
#container #imgGrid figure {
width: 50%;
height: 0;
padding-bottom: 37.5%;
position: relative;
float: left;
}
// HTML
<div id="container">
<div id="imgMain">
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic01.jpg">
</figure>
<div id="imgGrid">
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic02.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic03.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic04.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic05.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic06.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic07.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic08.jpg">
</figure>
<figure>
<img src="http://cssguy4hire.com/codePenAssets/aspectRatio/pic01.jpg">
</figure>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
307 次 |
| 最近记录: |