Skip to content

Commit 087ee50

Browse files
committed
Style: minor edits
1 parent fe49fdc commit 087ee50

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

css_grid/base.css

+26
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,38 @@ a:active {
178178
}
179179

180180
.container-h {
181+
/* breakpoint */
182+
--w: 400px;
183+
/* num of columns when over breakpoint */
184+
--n: 5;
185+
/* num of columns when under breakpoint */
186+
--m: 1;
187+
188+
display: grid;
189+
grid-template-columns: repeat(
190+
auto-fit,
191+
minmax(
192+
clamp(
193+
100% / (var(--n) + 1) + 0.1%,
194+
(var(--w) - 100vw) * 1000,
195+
100% / (var(--m) + 1) + 0.1%
196+
),
197+
1fr
198+
)
199+
);
200+
gap: 5px;
201+
}
202+
203+
.container-i {
181204
/* first breakpoint */
182205
--w1: 800px;
206+
/* number of columns when over first breakpoint */
183207
--n: 5;
184208
/* second breakpoint */
185209
--w2: 400px;
210+
/* number of columns when over second breakpoint */
186211
--m: 2;
212+
/* cols will be 100% when under second breakpoint */
187213

188214
display: grid;
189215
grid-template-columns: repeat(

css_grid/index.html

+10
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ <h1> Named areas.</h1>
166166
<div class="basic-box">A</div>
167167
</div>
168168

169+
<div class="container-i base">
170+
<div class="basic-box">A</div>
171+
<div class="basic-box">A</div>
172+
<div class="basic-box">A</div>
173+
<div class="basic-box">A</div>
174+
<div class="basic-box">A</div>
175+
<div class="basic-box">A</div>
176+
<div class="basic-box">A</div>
177+
</div>
178+
169179
<p> See <a href="https://css-tricks.com/responsive-layouts-fewer-media-queries/" target="_blank" rel="noopener noreferrer">Responsive Layouts, Fewer Media Queries</a>
170180

171181

css_truncate_text/base.css

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ html {
2727

2828
/* TYPOGRAPHY ------------------------------------------------------------- */
2929

30+
.max-width {
31+
max-width: 200px;
32+
}
3033
.truncate-text {
3134
/* display: inline-block; */
3235
overflow: hidden;
3336
white-space: nowrap;
3437
text-overflow: ellipsis;
35-
width: 220px;
3638
}
3739

3840

css_truncate_text/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ <h1 class="primary-heading">
1717
<nav></nav>
1818
</header>
1919

20-
<main>
20+
<main class="max-width">
2121

22-
<p class="truncate-text">If I exceed a specified width, I will be truncated.</p>
22+
<p class="truncate-text">If I don't fit, I will be truncated.</p>
2323

2424
</main>
2525

0 commit comments

Comments
 (0)