Skip to content

Commit 577895e

Browse files
committed
fix the layout on phones
The code sample pushed the page wider than the screen: a grid item will not shrink below its content, so one long URL in the snippet was enough. The grid children may shrink now, and the snippet wraps instead of scrolling on the narrowest screens. The counters read as one block on a phone — two columns, no separators, and the fifth item alone in a row. Below 640 px they become a list: a label and its number per row, with a hairline between them. The tracker has been 1.6 KB for a while; the page still said 1.3 KB.
1 parent ab049eb commit 577895e

3 files changed

Lines changed: 61 additions & 6 deletions

File tree

‎assets/style.css‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,3 +746,58 @@ td strong {
746746
grid-template-columns: repeat(2, 1fr);
747747
}
748748
}
749+
750+
/* Mobile -------------------------------------------------------------------
751+
Grid items refuse to shrink below their content unless told otherwise, and a
752+
long unbreakable line in the code sample was enough to push the whole page
753+
wider than the screen. */
754+
755+
.steps > *,
756+
.cards > *,
757+
.numbers-inner > * {
758+
min-width: 0;
759+
}
760+
761+
@media (max-width: 559px) {
762+
/* Let the snippet wrap instead of scrolling on the narrowest screens. */
763+
pre {
764+
white-space: pre-wrap;
765+
overflow-wrap: anywhere;
766+
}
767+
}
768+
769+
@media (max-width: 639px) {
770+
/* Counters as a list: a value and its label per row, hairlines between. */
771+
.numbers-inner {
772+
grid-template-columns: 1fr;
773+
gap: 0;
774+
padding: 10px 0;
775+
}
776+
777+
.numbers-inner .stat {
778+
display: flex;
779+
align-items: baseline;
780+
justify-content: space-between;
781+
gap: 16px;
782+
padding: 13px 0;
783+
border-bottom: 1px solid var(--border);
784+
}
785+
786+
.numbers-inner .stat:last-child {
787+
border-bottom: 0;
788+
}
789+
790+
.numbers-inner .stat span {
791+
order: 1;
792+
margin: 0;
793+
font-size: 13.5px;
794+
letter-spacing: 0;
795+
text-transform: none;
796+
}
797+
798+
.numbers-inner .stat b {
799+
order: 2;
800+
font-size: 1.15rem;
801+
white-space: nowrap;
802+
}
803+
}

‎index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h1>Web analytics for sites that only have PHP and MySQL.</h1>
131131
<a class="btn btn-ghost" href="https://github.com/plotbird/analytics">Read the code</a>
132132
</div>
133133
<p class="hero-note">
134-
Tracker <code>1.3 KB</code> &middot; dashboard CSS <code>43 KB</code>, pre-compiled &middot;
134+
Tracker <code>1.6 KB</code> &middot; dashboard CSS <code>43 KB</code>, pre-compiled &middot;
135135
MySQL 5.7+ or MariaDB 10.2+
136136
</p>
137137
</div>
@@ -194,7 +194,7 @@ <h3>No cookies at all</h3>
194194
</div>
195195
<h3>Featherweight by design</h3>
196196
<p>
197-
1.3 KB of JavaScript, pre-compiled CSS and every library vendored locally, so
197+
1.6 KB of JavaScript, pre-compiled CSS and every library vendored locally, so
198198
the dashboard also works on a server without internet access. Schema changes
199199
arrive as SQL you apply from the settings page.
200200
</p>
@@ -205,7 +205,7 @@ <h3>Featherweight by design</h3>
205205

206206
<section class="numbers" aria-label="Numbers">
207207
<div class="wrap numbers-inner">
208-
<div class="stat"><b>1.3 KB</b><span>tracker</span></div>
208+
<div class="stat"><b>1.6 KB</b><span>tracker</span></div>
209209
<div class="stat"><b>43 KB</b><span>dashboard CSS</span></div>
210210
<div class="stat"><b>710 834</b><span>IP ranges inside</span></div>
211211
<div class="stat"><b>256</b><span>end-to-end checks</span></div>

‎ru/index.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h1>Веб-аналитика для сайтов, у которых есть т
130130
<a class="btn btn-ghost" href="https://github.com/plotbird/analytics">Посмотреть код</a>
131131
</div>
132132
<p class="hero-note">
133-
Счётчик <code>1,3 КБ</code> &middot; CSS дашборда <code>43 КБ</code>, без сборщика &middot;
133+
Счётчик <code>1,6 КБ</code> &middot; CSS дашборда <code>43 КБ</code>, без сборщика &middot;
134134
MySQL 5.7+ или MariaDB 10.2+
135135
</p>
136136
</div>
@@ -192,7 +192,7 @@ <h3>Без cookie</h3>
192192
</div>
193193
<h3>Лёгкий по устройству</h3>
194194
<p>
195-
1,3 КБ JavaScript, заранее собранный CSS, все библиотеки лежат рядом — дашборд
195+
1,6 КБ JavaScript, заранее собранный CSS, все библиотеки лежат рядом — дашборд
196196
работает даже на сервере без доступа в интернет. Изменения схемы приходят
197197
обычным SQL и применяются из настроек.
198198
</p>
@@ -203,7 +203,7 @@ <h3>Лёгкий по устройству</h3>
203203

204204
<section class="numbers" aria-label="Цифры">
205205
<div class="wrap numbers-inner">
206-
<div class="stat"><b>1,3 КБ</b><span>счётчик</span></div>
206+
<div class="stat"><b>1,6 КБ</b><span>счётчик</span></div>
207207
<div class="stat"><b>43 КБ</b><span>CSS дашборда</span></div>
208208
<div class="stat"><b>710 834</b><span>диапазона IP внутри</span></div>
209209
<div class="stat"><b>256</b><span>сквозные проверки</span></div>

0 commit comments

Comments
 (0)