Fixed Background Image with CSS

CSS has attribute to set your background image fixed, meaning the background will be still, not moving even you scroll up and down.

body
{
    background: url("../images/BackgroundPattern.jpg");
    background-attachment: fixed;
}

By setting the background attachment to fixed, your background will be static and only your content will be moving when the page is scrolled.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s