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.

Firefox 4: CSS3 calc()

89 pointsby rlmalmost 15 years ago

9 comments

cscottaalmost 15 years ago
Of course, the humor here lies in the fact that IE has had dynamic CSS calculations since IE 5, but is now in the process of removing them – just as they are being standardized in other browsers.<p>For example [1]: &#60;div style="left:expression(document.body.clientWidth/2-oDiv.offsetWidth/2);"&#62;Content&#60;/div&#62;<p>These expressions (or "dynamic properties") essentially evaluated JScript embedded inside a stylesheet and provided some handy hacks to get around otherwise-painful bugs. This included simple math calculations as described in the Mozilla post, but also more complex transformations such as varying the style of an element based on the current day (or other JS-retrievable information).<p>Funny to see Mozilla phasing this in just as Microsoft phases something similar out [2].<p>[1] <a href="http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx" rel="nofollow">http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-express...</a><p>[2] <a href="http://msdn.microsoft.com/en-us/library/ms537634(VS.85).aspx#Implement" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms537634(VS.85).aspx...</a>
评论 #1421625 未加载
评论 #1421593 未加载
rlmalmost 15 years ago
Life would be so much easier if this were standardized!
Kilimanjaroalmost 15 years ago
While calc() is nice, I rather have vars or defs so I can declare a color once and use it everywhere so if I decide to change the color I just change it in one place at the top.
评论 #1421389 未加载
RyanMcGrealalmost 15 years ago
Tell me again why Mozilla keeps using the -moz prefix when it implements features of CSS3?
评论 #1421456 未加载
评论 #1421433 未加载
评论 #1421596 未加载
评论 #1421558 未加载
评论 #1421460 未加载
nitrogenalmost 15 years ago
I'm glad the mod operator is included, to make it easy to divide a page into n equally-sized blocks depending on some other parameter. I wonder if calc() will integrate with counters or otherwise allow the use of variables, or if that will remain the domain of JavaScript (I like having my pages work 100% without JavaScript if it's possible, to avoid NoScript issues). I guess I'll have to read the spec.
kristiandupontalmost 15 years ago
The features of LESS seem like much more obvious lacks in CSS than this to me. (<a href="http://lesscss.org/" rel="nofollow">http://lesscss.org/</a>)
tszmingalmost 15 years ago
While CSS 3 gives you some new cool features, but they be another performance killers, so use it wisely.<p>e.g.<p><a href="http://support.mozilla.com/tiki-view_forum_thread.php?comments_parentId=638706&#38;forumId=1" rel="nofollow">http://support.mozilla.com/tiki-view_forum_thread.php?commen...</a>
tybrisalmost 15 years ago
I've been hoping for something like this ever since I ran across <a href="http://www.marcoslot.net/alm.htm" rel="nofollow">http://www.marcoslot.net/alm.htm</a> . GUIs need programming too.
geuisalmost 15 years ago
I'm just curious, but this is <i>not</i> similar to IE css filters, right?
评论 #1422017 未加载