urn:uuid:28dff9f0-8e98-5647-9eac-abde451579d6
Topic: CSS – Ctrl blog
Daniel Aleksandersen
https://www.daniel.priv.no/
Copyright © 2022 Daniel Aleksandersen.
https://www.ctrl.blog/assets/logo/logo-square.svg
2022-05-21T13:25:00Z
weekly
10
urn:uuid:d7ed1254-4507-4836-a65d-de158a771a7b
2022-05-21T13:25:00Z
2022-05-21T13:25:00Z
Improve legibility and reduce layout shifts with x-height adjustments
The font-size CSS property sets the majuscule (“uppercase”) text size. The (font-)size-adjust property can set the minuscule (“lowercase”) size independently.
<p>There’s more to setting the text size on your webpages than just the CSS <code>font-size</code> property. It only controls the size of majuscule (“uppercase”, e.g. “A”) letters, numbers, and punctuation. The size of minuscule (“lowercase”, e.g. “a”) letters is left up to the font. A font’s minuscule size metric is referred to as x-height; the height of an “x” letter. However, you can control the size of the two independently — and here’s why you might want to do that.</p> <p><a href="https://www.ctrl.blog/entry/font-size-adjust.html">Read more …</a></p>
urn:uuid:795a9d32-a7c5-4765-86db-418785fa8100
2022-04-05T13:57:00Z
2022-04-05T13:57:00Z
Samsung devices incorrectly handle CSS @media hover queries
Samsung devices incorrectly handle CSS <code translate=no>@media hover</code> queries
The CSS @media hover query detects hover-capable input devices. Samsung touchscreens on Android gives unexpected results by pretending to be a computer touchpad.
<p>The <code>hover</code> <code>@media</code> feature query lets you check if a device’s primary input device supports hovering interactive elements. It became part of the web platform as of CSS Media Queries Level 4. The <code>hover: hover</code> query should match on devices with a mouse cursor (e.g. a touchpad), and <code>hover: none</code> should match touchscreens (mobile devices). Unfortunately, Samsung devices say their touchscreens are touchpads.</p> <p><a href="https://www.ctrl.blog/entry/css-media-hover-samsung.html">Read more …</a></p>
urn:uuid:964a6575-a074-4318-b1bf-005afe86b864
2022-01-19T13:58:00Z
2022-01-19T13:58:00Z
Font-independent pixel-perfect negative CSS text-indents
There’s no need to guess the number of negative pixels for a text-indent to create a list item marker or hanging punctuation. Use this CSS technique instead!
<p>The CSS <code>text-indent</code> property is used to offset the first line of text in a text block from the parent element’s inner box (the content area). It behaves like the <code>padding-inline-start</code> property, but only for a paragraph’s first line of text. It’s meant to allow your design to e.g. indent the first line to designate the start of a new paragraph (a more compact alternative to separating paragraphs by empty lines).</p> <p><a href="https://www.ctrl.blog/entry/css-negative-text-indent.html">Read more …</a></p>
urn:uuid:47aae321-5a93-49a0-b987-a2eaa7ebaa89
2022-01-15T14:39:00Z
2022-01-15T14:39:00Z
Why HTML table cells won’t fit into your CSS baseline grid
Collapsed cell borders adds to the table cell’s line height. So, how do you align your table cells to a line-height/baseline based grid layout?
<p>A baseline grid design is a fancy way of describing a page design laid out like on lined paper sheets. (The lines are not visible, of course.) It’s the art of ensuring your design and text maintain a rhythm and the same visual pacing throughout the page by using consistent line heights and spacing.</p> <p><a href="https://www.ctrl.blog/entry/css-table-cell-grid.html">Read more …</a></p>
urn:uuid:28322e08-039b-4443-939b-bc460fef9229
2021-09-18T09:19:00Z
2021-09-18T09:19:00Z
Improving the New York Times’ line wrap balancer
Improving the <em>New York Times’</em> line wrap balancer
Web browsers don’t yet support (text-wrap: balance). Adobe and the NY Times have offer free JavaScript alternatives. I improved the latter to suit my needs.
<p>I looked into options to improve the breaking points for line wrapping on the web. I found a few “text balancer” programs that use different methods to even out the number of words per line on the fewest number of lines possible. I wasn’t happy with any of them, but ended up improving on the New York Times’ text balancer to get something useable. It wasn’t how I imagined spending my weekend.</p> <p><a href="https://www.ctrl.blog/entry/text-wrap-balance.html">Read more …</a></p>