How to define a measurement in screen pixels with CSS?


To define a measurement in screen pixels with CSS, use the px unit.

Let us see an example:

<html>
   <head>
   </head>
   <body>
      <div style = "position:relative;left:90px;top:3px;background-color:yellow;">
         This div has relative positioning.
      </div>
   </body>
</html>

Updated on: 30-Jan-2020

137 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements