CSS

CSS Perfect Full Page Background Image

  • Oleh admin
  • 1 menit baca
  • Belum ada komentar

The goal here is a background image on a website that covers the entire browser window at all times. Let’s put some specifics on it:

  • Fills entire page with image, no white space
  • Scales image as needed
  • Retains image proportions (aspect ratio)
  • Image is centered on page
  • Does not cause scrollbars
  • As cross-browser compatible as possible
  • Isn’t some fancy shenanigans like Flash

html  {

background: url(images/bg.jpg) no-repeat center center fixed;

-webkit-background-size: cover;

-moz-background-size: cover;

-o-background-size: cover; background-size: cover;

}

Bagikan

Tentang Penulis

admin

Butuh Bantuan Mengembangkan Website atau Aplikasi?

Diskusikan kebutuhan proyek Anda dan tentukan solusi yang paling sesuai.

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *