HTML CSS examples for CSS:Length
The mainstream browsers treat 1 pixel to be 1/96 of an inch.
The following code demonstrates how to set pixels in a CSS style.
<!DOCTYPE HTML> <html> <head> <title>Example</title> <style type="text/css"> p {<!--from ww w . j ava 2 s . c o m--> background: grey; color:white; font-size: 20px; width: 200px; } </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>