TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

NoJS – Creating a calculator with only HTML and CSS

138 点作者 ColinEberhardt超过 3 年前

13 条评论

adamredwoods超过 3 年前
I thought this would be implemented by recreating a calculator logic gates using nothing but css selectors.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;SLaks&#x2F;Silon" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SLaks&#x2F;Silon</a>
OJFord超过 3 年前
Nice write-up, shame there&#x27;s not a demo embedded (but understandable, bet that would be a hassle to work out on our blog too; too much for a one-off).<p>Also quite entertaining to click through to ScottLogic&#x27;s home page after that, where the strapline for what they do is:<p>&gt; Pragmatic solutions to complex software challenges
评论 #30023952 未加载
nathell超过 3 年前
Do yourself a favor and try dividing by zero!
评论 #30026161 未加载
评论 #30026340 未加载
评论 #30025744 未加载
DaveSchmindel超过 3 年前
&gt; Well, everytime you divide by zero, a puppy dies.<p>Welp, I was a pretty heartless bastard back in the days of getting my first scientific calculator.
chrismorgan超过 3 年前
I’m disappointed with the reset button: it uses a dangling label inside a link, which reloads the page:<p><pre><code> &lt;a href=&quot;.&#x2F;calc.html&quot;&gt; &lt;label for=&quot;reset&quot;&gt;C&lt;&#x2F;label&gt; &lt;&#x2F;a&gt; </code></pre> Rather than just using the formerly-ubiquitous but now rare beast (I think I saw exactly one last year), a reset button:<p><pre><code> &lt;input type=&quot;reset&quot; value=&quot;C&quot;&gt; </code></pre> To keep the CSS simple (!), you could even keep using the label (though ditch the &lt;a&gt; wrapping) and just chuck an invisible &lt;input type=reset id=reset&gt; in with the radio buttons, if you really want. Then the label would dangle no more.
评论 #30027126 未加载
评论 #30028525 未加载
sisjohn超过 3 年前
It would be interesting to create complex mathematical computations and finding a solution without the proper help of JS.
评论 #30026820 未加载
dexwiz超过 3 年前
How long before all these CSS tricks come together to make a easily abusable injection mechanism? I know the `url()` mechanism is already abusable, but what about a small VM executed via `var` and `calc`?
Minor49er超过 3 年前
Unfortunately, it does not seem to work on Firefox for Android. Pressing any digit will always produce a 0 value
评论 #30027191 未加载
评论 #30032431 未加载
raxor53超过 3 年前
&gt; Why make this? &gt; Why not?<p>Yes, please
o_m超过 3 年前
Now make it accessible
tannhaeuser超过 3 年前
Are we Turing yet with CSS?
评论 #30023859 未加载
评论 #30023602 未加载
danielovichdk超过 3 年前
Why?
geoffeg超过 3 年前
You can even do this with pure HTML, no CSS or JavaScript! Server-side processing sometimes seems underutilized and forgotten.
评论 #30024396 未加载