Skip to main content
CSS-Tricks
  • Articles
  • Alamanac
  • Guides
  • Videos
  • Books
  • Newsletter
Search

Articles Tagged
fixed position

6 Articles
{
,

}
Direct link to the article The Search For a Fixed Background Effect With Inline Images
background-attachment background-image fixed position images

The Search For a Fixed Background Effect With Inline Images

I was working on a client project a few days ago and wanted to create a certain effect on an <img>. See, background images can do the effect I was looking for somewhat easily with background-attachment: fixed;. With …

Avatar of Alex Lazar
Alex Lazar on Jan 6, 2022 (Updated on Jan 9, 2022)
Direct link to the article The Fixed Background Attachment Hack
background-attachment fixed position scrolling

The Fixed Background Attachment Hack

What options do you have if you want the body background in a fixed position where it stays put on scroll? background-attachment: fixed in CSS, at best, does not work well in mobile browsers, and at worst is not even …

Avatar of Murtuzaali Surti
Murtuzaali Surti on Aug 27, 2021
Direct link to the article Going From Solid to Knockout Text on Scroll
clip fixed position typography

Going From Solid to Knockout Text on Scroll

Here’s a fun CSS trick to show your friends: a large title that switches from a solid color to knockout text as the background image behind it scrolls into place. And we can do it using plain ol’ HTML and …

Avatar of Blake Lundquist
Blake Lundquist on Feb 3, 2021
Direct link to the article On fixed elements and backgrounds
fixed position

On fixed elements and backgrounds

After just playing with apsect-ratio and being pleasantly surprised at how intuitive it is, here’s an example of CSS acting unintuitively:

If you have a fixed element on your page, which means it doesn’t move when you scroll, you

…
Avatar of Chris Coyier
Chris Coyier on Jun 3, 2020 (Updated on Jun 4, 2020)
Direct link to the article Sticky as a Local Fixed?
fixed position modal scrolling sticky

Sticky as a Local Fixed?

You know how position: relative creates a new context for absolute positioning within an element? Well, position: sticky is a locally scoped version of position: fixed. Let's take a look at how that works using a modal with a sticky close button as an example.
Avatar of Chris Coyier
Chris Coyier on Mar 26, 2018
Direct link to the article Use Cases for Fixed Backgrounds in CSS
background-attachment fixed position panels sliding

Use Cases for Fixed Backgrounds in CSS

File this into a category of personal “CSS Ah-Ha Moments“.

The background-attachment property has never seemed all that useful to me. I have always looked at it as some sort of old school design trick from the GeoCities …

Avatar of Geoff Graham
Geoff Graham on Aug 25, 2016 (Updated on Aug 26, 2016)

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways hosting
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Write for us!
  • Advertise with us
  • Contact us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • X
Back to Top