TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Save time testing HTML and CSS on the fly using only CSS

2 pointsby tinchox59 months ago
Recently, I made public a CSS framework I developed for creating radial designs.<p>During development, I faced several challenges, including testing different features. I noticed that CSS linters and other tools didn&#x27;t allow me to see why something wasn&#x27;t working, even if there were no basic errors. Another typical CSS problem was seeing how it was shared across different browsers. Fortunately, I discovered that certain new CSS features can be used to create a series of real-time tests. These features are @support, @container, and :has().<p>By combining these features, I developed a testing system not only to check if the framework works in the browser but also, and most importantly, to see if we are applying HTML correctly according to the browser&#x27;s requirements and avoiding involuntary errors when developing an application.<p>Since my CSS framework necessarily uses features that only the newest browsers have, such as trigonometric functions like cos() and sin(), I created a series of rules to test if they are supported by the browser. If they&#x27;re not, a message appears asking to update the browser. Similarly, if the browser doesn&#x27;t support :has(), which is used throughout the framework.<p>There are also typical cases of browser incompatibility, so in some non-critical cases, I use @support or @container to hide certain Orbit features that don&#x27;t affect its use. For example, Safari doesn&#x27;t accept SVG context-stroke, so I hide them.<p>However, beyond those critical checks and compatibility, the most common issue when using a CSS framework is not knowing how to use it properly. That&#x27;s why I created other CSS rules that allow analyzing if a parent element has the required child elements and not others. Here, visual alerts also appear while developing to give a hint about where the error is in the code.<p>I&#x27;ll leave some links in the comments below for further reading.

1 comment

tinchox59 months ago
Repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;zumerlab&#x2F;orbit">https:&#x2F;&#x2F;github.com&#x2F;zumerlab&#x2F;orbit</a><p>Source file: <a href="https:&#x2F;&#x2F;github.com&#x2F;zumerlab&#x2F;orbit&#x2F;blob&#x2F;main&#x2F;src&#x2F;scss&#x2F;_support.scss">https:&#x2F;&#x2F;github.com&#x2F;zumerlab&#x2F;orbit&#x2F;blob&#x2F;main&#x2F;src&#x2F;scss&#x2F;_suppor...</a><p>Orbit related documentation: <a href="https:&#x2F;&#x2F;zumerlab.github.io&#x2F;orbit-docs&#x2F;tools&#x2F;support&#x2F;" rel="nofollow">https:&#x2F;&#x2F;zumerlab.github.io&#x2F;orbit-docs&#x2F;tools&#x2F;support&#x2F;</a><p>Good to read: <a href="https:&#x2F;&#x2F;heydonworks.com&#x2F;article&#x2F;testing-html-with-modern-css" rel="nofollow">https:&#x2F;&#x2F;heydonworks.com&#x2F;article&#x2F;testing-html-with-modern-css</a>