Chapter 5. Using Background Images in CSS

Background images are on almost all pages. This chapter will describe how to craft an optimal website with images displayed correctly on the wide spectrum of modern devices including mobile phones and tablets.

In this chapter, we will cover the following topics:

  • Usage of background images
  • How to set proper position for background images
  • How to set the size of a background position
  • Images on retina and mobile devices

CSS backgrounds

CSS backgrounds are very useful in modern web browsers. When should you use a background and when should you use the img tag? It's a simple question—every image that is an element of content should be inserted into the img tag and every image that is an element of a layout should be ...

Get Professional CSS3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.