|
| 1 | +/* A bit custom styling */ |
| 2 | +.my-page .ui-listview li .ui-btn p { |
| 3 | + color: #c0c0c0; |
| 4 | +} |
| 5 | +.my-page .ui-listview li .ui-btn .ui-li-aside { |
| 6 | + color: #eee; |
| 7 | +} |
| 8 | + |
| 9 | +/* First breakpoint is 48em (768px). 3 column layout. Tiles 250x250 pixels incl. margin at the breakpoint. */ |
| 10 | +@media ( min-width: 48em ) { |
| 11 | + .my-page .ui-content { |
| 12 | + padding: .5625em; /* 9px */ |
| 13 | + } |
| 14 | + .my-page .ui-listview li { |
| 15 | + float: left; |
| 16 | + width: 30.9333%; /* 33.3333% incl. 2 x 1.2% margin */ |
| 17 | + height: 14.5em; /* 232p */ |
| 18 | + margin: .5625em 1.2%; |
| 19 | + } |
| 20 | + .my-page .ui-listview li > .ui-btn { |
| 21 | + -webkit-box-sizing: border-box; /* include padding and border in height so we can set it to 100% */ |
| 22 | + -moz-box-sizing: border-box; |
| 23 | + box-sizing: border-box; |
| 24 | + height: 100%; |
| 25 | + } |
| 26 | + .my-page .ui-listview li.ui-li-has-thumb .ui-li-thumb { |
| 27 | + height: auto; /* To keep aspect ratio. */ |
| 28 | + max-width: 100%; |
| 29 | + max-height: none; |
| 30 | + } |
| 31 | + /* Make all list items and anchors inherit the border-radius from the UL. */ |
| 32 | + .my-page .ui-listview li, |
| 33 | + .my-page .ui-listview li .ui-btn, |
| 34 | + .my-page .ui-listview .ui-li-thumb { |
| 35 | + -webkit-border-radius: inherit; |
| 36 | + border-radius: inherit; |
| 37 | + } |
| 38 | + /* Hide the icon */ |
| 39 | + .my-page .ui-listview .ui-btn-icon-right:after { |
| 40 | + display: none; |
| 41 | + } |
| 42 | + /* Make text wrap. */ |
| 43 | + .my-page .ui-listview h2, |
| 44 | + .my-page .ui-listview p { |
| 45 | + white-space: normal; |
| 46 | + overflow: visible; |
| 47 | + position: absolute; |
| 48 | + left: 0; |
| 49 | + right: 0; |
| 50 | + } |
| 51 | + /* Text position */ |
| 52 | + .my-page .ui-listview h2 { |
| 53 | + font-size: 1.25em; |
| 54 | + margin: 0; |
| 55 | + padding: .125em 1em; |
| 56 | + bottom: 50%; |
| 57 | + } |
| 58 | + .my-page .ui-listview p { |
| 59 | + font-size: 1em; |
| 60 | + margin: 0; |
| 61 | + padding: 0 1.25em; |
| 62 | + min-height: 50%; |
| 63 | + bottom: 0; |
| 64 | + } |
| 65 | + /* Semi transparent background and different position if there is a thumb. The button has overflow hidden so we don't need to set border-radius. */ |
| 66 | + .ui-listview .ui-li-has-thumb h2, |
| 67 | + .ui-listview .ui-li-has-thumb p { |
| 68 | + background: #111; |
| 69 | + background: rgba(0,0,0,.8); |
| 70 | + } |
| 71 | + .ui-listview .ui-li-has-thumb h2 { |
| 72 | + bottom: 35%; |
| 73 | + } |
| 74 | + .ui-listview .ui-li-has-thumb p { |
| 75 | + min-height: 35%; |
| 76 | + } |
| 77 | + /* ui-li-aside has class .ui-li-desc as well so we have to override some things. */ |
| 78 | + .my-page .ui-listview .ui-li-aside { |
| 79 | + padding: .125em .625em; |
| 80 | + width: auto; |
| 81 | + min-height: 0; |
| 82 | + top: 0; |
| 83 | + left: auto; |
| 84 | + bottom: auto; |
| 85 | + /* Custom styling. */ |
| 86 | + background: #990099; |
| 87 | + background: rgba(153,0,153,.85); |
| 88 | + -webkit-border-top-right-radius: inherit; |
| 89 | + border-top-right-radius: inherit; |
| 90 | + -webkit-border-bottom-left-radius: inherit; |
| 91 | + border-bottom-left-radius: inherit; |
| 92 | + -webkit-border-bottom-right-radius: 0; |
| 93 | + border-bottom-right-radius: 0; |
| 94 | + } |
| 95 | + /* If you want to add shadow, don't kill the focus style. */ |
| 96 | + .my-page .ui-listview li { |
| 97 | + -moz-box-shadow: 0px 0px 9px #111; |
| 98 | + -webkit-box-shadow: 0px 0px 9px #111; |
| 99 | + box-shadow: 0px 0px 9px #111; |
| 100 | + } |
| 101 | + /* Images mask the hover bg color so we give desktop users feedback by applying the focus style on hover as well. */ |
| 102 | + .my-page .ui-listview li > .ui-btn:hover { |
| 103 | + -moz-box-shadow: 0px 0px 12px #33ccff; |
| 104 | + -webkit-box-shadow: 0px 0px 12px #33ccff; |
| 105 | + box-shadow: 0px 0px 12px #33ccff; |
| 106 | + } |
| 107 | + /* Animate focus and hover style, and resizing. */ |
| 108 | + .my-page .ui-listview li, |
| 109 | + .my-page .ui-listview .ui-btn { |
| 110 | + -webkit-transition: all 500ms ease; |
| 111 | + -moz-transition: all 500ms ease; |
| 112 | + -o-transition: all 500ms ease; |
| 113 | + -ms-transition: all 500ms ease; |
| 114 | + transition: all 500ms ease; |
| 115 | + } |
| 116 | +} |
| 117 | + |
| 118 | +/* Second breakpoint is 63.75em (1020px). 4 column layout. Tiles will be 250x250 pixels incl. margin again at the breakpoint. */ |
| 119 | +@media ( min-width: 63.75em ) { |
| 120 | + .my-page .ui-content { |
| 121 | + padding: .625em; /* 10px */ |
| 122 | + } |
| 123 | + /* Set a max-width for the last breakpoint to prevent too much stretching on large screens. |
| 124 | + By setting the max-width equal to the breakpoint width minus padding we keep square tiles. */ |
| 125 | + .my-page .ui-listview { |
| 126 | + max-width: 62.5em; /* 1000px */ |
| 127 | + margin: 0 auto; |
| 128 | + } |
| 129 | + /* Because of the 1000px max-width the width will always be 230px (and margin left/right 10px), |
| 130 | + but we stick to percentage values for demo purposes. */ |
| 131 | + .my-page .ui-listview li { |
| 132 | + width: 23%; |
| 133 | + height: 230px; |
| 134 | + margin: .625em 1%; |
| 135 | + } |
| 136 | +} |
| 137 | + |
| 138 | +/* For this demo we used images with a size of 310x310 pixels. Just before the second breakpoint the images reach their max width: 1019px - 2 x 9px padding = 1001px x 30.9333% = ~310px */ |
0 commit comments