It already exists; You can use the CSS3 calc()
notation:
div {
background: olive;
height: 200px;
width: 200px;
}
div > div {
background: azure;
height: calc(100% - 10px);
width: 100px;
}
http://jsfiddle.net/NejMF/
Note: It's only supported in modern browsers (IE9+) and has only recently been adopted by mobile browsers.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…