Skip to content

Commit bae13ff

Browse files
committed
Modified with demo
More accurate css with codepen demo Thanks
1 parent 0ce30c6 commit bae13ff

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,29 +236,40 @@ That's pretty convenient.
236236
This is usefull where ever you encounter fluid responsive container boxes (product catalog grid etc). Use a parent container having fluid `width`:
237237

238238
```css
239+
/*some value based on responsive need.*/
240+
239241
.container {
240-
width:20%; /*some value based on responsive need.*/
242+
width: 20%;
241243
}
242-
243244
/*a content wrapper.*/
245+
244246
.container > div {
245-
width:100%;
246-
display:inline-block;
247+
width: 100%;
248+
height: 0;
249+
position: relative;
247250
}
248-
249251
/*padding-top is relative to width of the parent container that is the trick
250252
* here the aspect ratio is 1:1 a square box.
251253
*/
252-
.container > div > .content {
253-
padding-top: 120%;
254+
255+
.container > div:before {
256+
padding-top: 100%;
254257
width: 100%;
255-
height: 0;
256-
position:absolute;
257-
top:0;
258-
left:0;
258+
background: #009530;
259+
border-radius: 8px;
260+
content: ' ';
261+
position: absolute;
262+
top: 0;
263+
}
264+
.container .content {
265+
position: absolute;
266+
font-size: 2em;
267+
color: blue;
259268
}
260269
```
261270

271+
CodePen - [Demo](http://codepen.io/shanksrepo/pen/OygmNB) Change the width of browser to see the effect.
272+
262273
### Support
263274

264275
These protips work in current versions of Chrome, Firefox, Safari, and Edge, and in IE11.

0 commit comments

Comments
 (0)