HTML CSS examples for CSS:Length
CSS3 lets you calculate units.
You use the calc keyword and parentheses to encompass a calculation.
<!DOCTYPE HTML> <html> <head> <title>Example</title> <style type="text/css"> p {<!-- w w w . j av a2s . co m--> background: grey; color:white; font-size: 20pt; width: calc(80% - 20px); } </style> </head> <body> <a href="http://java2s.com">Website</a> <p>I like <span>CSS</span> and HTML.</p> <a class="myclass1 myclass2" href="http://w3c.org">Visit the W3C website</a> </body> </html>