sign up log in tour help. 1  Tour Start here for a quick overview of the site. 2  Help Center Detailed answers to any questions you might have. 3  Meta Discuss the workings and policies of this site.  About Us Learn more about Stack Overflow the 1  company. Business Learn more about hiring developers or posting ads with  us.
With this set, an image meant to be 5 inches wide at 300dpi will actually display as 5in wide; without this set, the image would display as approximately 15.6in wide since the image is 15000 image pixels across, and by default CSS displays 96 image pixels per inch.
How to Add an Image to a CSS File. Code images with CSS to increase your design options. Comstock/Comstock/Getty Images. Web pages normally add images using the inline HTML img tag. CSS coding usually doesn't set an image's source because CSS controls design rather than content.Yet CSS supports properties that plain HTML does not, such as image opacity.or example, if the image measures 200 pixels high and 600 pixels wide, change the code to: #styledimg { background-image: url(/images/building.jpg); background-repeat: no-repeat; width: 600px; height: 200px; }. Step 5. Open the Web page where you want to insert the image.