Skip to content

Commit e3fb777

Browse files
committed
updated css to split to demo and use CSS grid for layout
1 parent d61752f commit e3fb777

3 files changed

Lines changed: 537 additions & 175 deletions

File tree

css/demo-style.css

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/*
2+
==========================
3+
General Styles
4+
==========================
5+
These are the styles that will apply to the page first. It includes things like basic fonts, font-size, link styling, list, base nvigation styling and so on. I'm not including most of that here but instead a couple of things that will help in most responsive designs (there is no "always" rule).
6+
*/
7+
8+
/* Border Box
9+
This is used to help you be able to set the widths of things once and then come and fiddle with borders and padding later without having to recalculate and change the width (something you have to do with the standard, default setting).
10+
*/
11+
* {
12+
-moz-box-sizing: border-box;
13+
-webkit-box-sizing: border-box;
14+
-ms-box-sizing: border-box;
15+
-o-box-sizing: border-box;
16+
-icab-box-sizing: border-box;
17+
-khtml-box-sizing: border-box;
18+
box-sizing: border-box;
19+
}
20+
21+
22+
/* Responsive Media
23+
These settings allow media elements (img, video) to change size as their containing element changes size (which is part of a fluid grid and you want to happen).
24+
*/
25+
img,
26+
video {
27+
width: auto;
28+
max-width: 100%;
29+
height: auto;
30+
}
31+
32+
/* Video Embed (youtube or vimeo etc)*/
33+
.videoWrapper {
34+
position: relative;
35+
padding-top: 25px;
36+
height: 0;
37+
clear: both;
38+
outline: 1px solid red;
39+
}
40+
41+
.videoWrapper.ratio-16-9 {
42+
padding-bottom: 56.25%;
43+
/* 16:9 */
44+
}
45+
46+
.videoWrapper.ratio-4-3 {
47+
padding-bottom: 75%;
48+
/* 4:3 */
49+
}
50+
51+
.videoWrapper iframe {
52+
position: absolute;
53+
top: 0;
54+
left: 0;
55+
width: 100%;
56+
height: 100%;
57+
}
58+
59+
60+
/* Specific tyles for this design
61+
These are just some specific styles I set to make the boxes look nice. You can ignore for your own designs. Setting the body font-size is important though as it sets the tone for all of the ems you wil use.
62+
*/
63+
64+
/* ==== Base page styles, apply to all browsers ==== */
65+
body {
66+
font-size: 100%;
67+
line-height: 1.5;
68+
font-family: sans-serif;
69+
padding: 0 20px;
70+
}
71+
72+
p {
73+
margin-bottom: 1em;
74+
}
75+
76+
.feature {
77+
border: 1px solid #555;
78+
padding: 0.625em;
79+
/* 10/16 */
80+
}
81+
82+
.feature p:first-letter {
83+
float: left;
84+
font-size: 300%;
85+
margin: 0 5px 0 0;
86+
line-height: 1;
87+
}
88+
89+
.boxes {
90+
margin: 60px 0;
91+
}
92+
93+
.box {
94+
border: 1px solid #999;
95+
/* margin-bottom:1em;*/
96+
padding: .5em;
97+
height: 4em;
98+
line-height: 3em;
99+
text-align: center;
100+
background-color: #fafafa;
101+
}
102+
103+
footer {
104+
border-top: 3px solid #999;
105+
}
106+
107+
108+
/* ==============================
109+
Media Queries
110+
==============================
111+
This is the media queries that make the site change at different screen widths.
112+
*/
113+
114+
/* Your layout code goes here
115+
Here is a good place to put the code you have for your default layout. By default layout I mean the one that people see if there are no media queries. If you are doing mobile-first design this is where you would style the mobile look. If not then you can just do whatever it is you normally do for a site.
116+
*/
117+
118+
@supports (grid-area: auto) {
119+
.features {
120+
display: grid;
121+
grid-gap: 20px;
122+
grid-template-columns: 1fr;
123+
}
124+
125+
.boxes {
126+
display: grid;
127+
grid-gap: 20px;
128+
grid-template-columns: 1fr 1fr;
129+
}
130+
131+
@media (min-width: 600px) {
132+
133+
/* this applies to mobile in landscape and some tablets in portrait */
134+
.boxes {
135+
grid-template-columns: 1fr 1fr 1fr;
136+
}
137+
}
138+
139+
/* end min-width 600 */
140+
141+
142+
143+
@media (min-width: 900px) {
144+
145+
/* this applies to tablets */
146+
.features {
147+
grid-template-columns: 1fr 1fr 1fr;
148+
}
149+
150+
.boxes {
151+
grid-template-columns: 1fr 1fr 1fr 1fr;
152+
}
153+
154+
}
155+
156+
/* end min-width 900 */
157+
158+
159+
160+
@media (min-width: 1200px) {
161+
162+
/* this applies average laptops */
163+
.boxes {
164+
grid-template-columns: repeat(6, 1fr);
165+
}
166+
167+
}
168+
169+
/* end min-width 1200 */
170+
171+
172+
173+
@media (min-width: 1800px) {
174+
175+
/* this applies to large laptops and desktops */
176+
.boxes {
177+
grid-template-columns: repeat(12, 1fr);
178+
}
179+
180+
}
181+
182+
}
183+
184+
/* end @supports grid */

0 commit comments

Comments
 (0)