Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Background Image without scrolling

Featured Replies

Hey there,

 

I was wondering if I can use a background image that's about 1300pixels wide and set some code so that those with smaller screen don't have to scroll and the image stays 100% in size? So they are seeing less of the image but it's still the same size.

 

Thank you

You can use background-attachment: fixed to fix the position of the image.

 

background-position lets you anchor it to a particular corner

 

 

body {
   background:#4C636A url(images/bg.jpg) 0 0 repeat-x;
   background-attachment: fixed;
   background-position: bottom right;
}

A background-image cannot stretch but you can use a normal image with position: absolute; or position: fixed; width: 100%; left: 0; right: 0; which ties the image to the sides so that it will always be 100% wide.

 

Put it in a container and layer page content on top or use position: absolute with z-index: -1 so that it's always underneath like I did here:-

http://www.wickham43.net/backgroundfullwidthflexible.html

Drag the window wider and narrower to see the effect.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.