casperOne:我想用CSS设置一个50px的 p ,不能超过100%宽度,也不用JavaScript。如何实现?
小伙看你根骨奇佳,潜力无限,来学PHP伐。
Derek: can be implemented, but you don’t need to use IE’s expression(), but use Calc() in CSS3.
p { width: 100%; width: -webkit-calc(100% - 50px); width: -moz-calc(100% - 50px); width: calc(100% - 50px); }
Demo: http://jsfiddle.net/thirtydot/Nw3yd/66/
This is very convenient, but it should be noted that there are currently only 3 browsers that support CSS3: Firefox, Google Chrome (WebKit) and IE9
Detailed explanation of Calc attribute: https://developer.mozilla.org/zh-CN/docs/CSS/calc
Derek: can be implemented, but you don’t need to use IE’s expression(), but use Calc() in CSS3.
Demo: http://jsfiddle.net/thirtydot/Nw3yd/66/
This is very convenient, but it should be noted that there are currently only 3 browsers that support CSS3: Firefox, Google Chrome (WebKit) and IE9
Detailed explanation of Calc attribute: https://developer.mozilla.org/zh-CN/docs/CSS/calc