- How TO — Parallax Scrolling
- Parallax
- How To Create a Parallax Scrolling Effect
- Example with pixels
- Example with percent
- Example
- Параллакс эффект для фона сайта на чистом CSS
- Видео:
- Пример параллакс эффекта для фоне:
- This is parallax
- Вот и сам код:
- 26 CSS Parallax Effects
- Related Articles
- Author
- Links
- Made with
- About a code
- Parallax Photo Columns with CSS Scroll Linked Animations
- Author
- Links
- Made with
- About a code
- Disney Wall Parallax. Only CSS
- Author
- Links
- Made with
- About a code
- Easy Parallax Effect with background-attachment: fixed
- Author
- Links
- Made with
- About a code
- CSS Sticky Parallax Sections
- Author
- Links
- Made with
- About a code
- CSS Parallax Hero
- Author
- Links
- Made with
- About a code
- CSS-Only Horizontal Parallax Gallery
- Author
- Links
- Made with
- About a code
- Pure CSS Multilayer Parallax
- Author
- Links
- Made with
- About a code
- Whole UI without JavaScript
- Author
- Links
- Made with
- About the code
- Mouse Move Parallax
- Author
- Links
- Made with
- About the code
- Parallax Effect
- Author
- Links
- Made with
- About the code
- Parallax Shadows
- Author
- Links
- Made with
- About the code
- 3D CSS Parallax Depth Effect
- Author
- Links
- Made with
- About the code
- Image Cutout, Parallax Effect: CSS + SVG
- Author
- Links
- Made with
- About the code
- CSS Only Parallax
- Author
- Links
- Made with
- About the code
- CSS-Only Parallax Effect
- Author
- Links
- Made with
- About the code
- Parallax Image Gallery
- Author
- Links
- Made with
- About the code
- Page Top Parallax
- Author
- Links
- Made with
- About a code
- Parallax Scroll
- Author
- Links
- Made with
- About the code
- Parallax Grid
- Author
- Links
- Made with
- About the code
- Parallax Background
- Author
- Links
- Made with
- About a code
- Card
- Author
- Links
- Made with
- About a code
- CSS Parallax Orbs
- Author
- Links
- Made with
- About a code
- Responsive Magazine Spread
- Author
- Links
- Made with
- About a code
- Parallax Landscape CSS Only
- Author
- Links
- Made with
- About a code
- Pure CSS Parallax Effect (Depth of Field)
- Author
- Links
- Made with
- About a code
- Parallax World of UGG
- Как добавить параллакс-эффект к фоновому изображению
- Шаг 1: Создание HTML-структуры
- Шаг 2: Добавление стилей CSS
- Шаг 3: Добавление JavaScript для эффекта параллакса
How TO — Parallax Scrolling
Learn how to create a «parallax» scrolling effect with CSS.
Parallax
Parallax scrolling is a web site trend where the background content (i.e. an image) is moved at a different speed than the foreground content while scrolling. Click on the links below to see the difference between a website with and without parallax scrolling.
Note: Parallax scrolling does not always work on mobile devices/smart phones. However, you can use media queries to turn off the effect on mobile devices (see last example on this page).
How To Create a Parallax Scrolling Effect
Use a container element and add a background image to the container with a specific height. Then use the background-attachment: fixed to create the actual parallax effect. The other background properties are used to center and scale the image perfectly:
Example with pixels
/* Set a specific height */
min-height: 500px;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
>
The example above used pixels to set the height of the image. If you want to use percent, for example 100%, to make the image fit the whole screen, set the height of the parallax container to 100%. Note: You must also apply height: 100% to both and :
Example with percent
.parallax <
/* The image used */
background-image: url(«img_parallax.jpg»);
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
>
Some mobile devices have a problem with background-attachment: fixed . However, you can use media queries to turn off the parallax effect for mobile devices:
Example
/* Turn off parallax scrolling for all tablets and phones. Increase/decrease the pixels if needed */
@media only screen and (max-device-width: 1366px) .parallax background-attachment: scroll;
>
>
Параллакс эффект для фона сайта на чистом CSS
Приветствую на страницах сайта WebDevTips. Сегодня покажу, как за 2-3 минуты сделать параллакс эффект для заднего фона вашего сайта. Писать будем на чистом CSS. Без использования JS, или каких либо библиотек. Наверняка вы часто встречали этот эффект. Это один из элементов wow-дизайна, который не только красиво выглядит, но и повышает конверсию.
Кстати, еще одним элементом wow-дизайна является видео фон для сайта. Если вы еще не знаете как поставить видео на фон вашего сайта — рекомендую ознакомится с моей статьей.
Видео:
Пример параллакс эффекта для фоне:
This is parallax
Вот и сам код:
This is parallax .parallax < background-image: url(bg-image.jpg); height: 500px; background-attachment: fixed; display: flex; justify-content: center; color: #ffffff; font-size: 60px; align-items: center; position: relative; >.parallax .mask < position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,.6); z-index: 2; >.parallax h1
В принципе, на этом код параллакса заканчивается. Далее необходимо добавить только контент вверху и внизу от него, что бы увидеть сам эффект!
Вот все файлы с полным кодом из видео урока — скачать.
Спасибо, что прочитали! Если у вас остались любые вопросы — задавайте их в комментариях, буду рад ответить)
Буду очень благодарен, если вы подпишитесь на мой Telegram-канал , или YouTube.
Full Stack разработчик, Frontend: Vue.js (2,3) + VueX + Vue Router, Backend: Node.js + Express.js. Раньше работал с РНР, WordPress, написал несколько проектов на Laravel. Люблю помогать людям изучать что-то новое)
26 CSS Parallax Effects
Collection of hand-picked free HTML and CSS parallax effect code examples from Codepen, GitHub and other resources. Update of February 2021 collection. 11 new items.
Related Articles
Author
Links
Made with
About a code
Parallax Photo Columns with CSS Scroll Linked Animations
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Disney Wall Parallax. Only CSS
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Easy Parallax Effect with background-attachment: fixed
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Sticky Parallax Sections
Uses position: sticky and scale transforms to create a sticky parallax effect with CSS.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Parallax Hero
Parallax effect created with CSS transforms and perspective properties.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS-Only Horizontal Parallax Gallery
A few beautiful photos from Paris in this experimental gallery. Uses transforms together with perspective property for parallax.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Pure CSS Multilayer Parallax
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Whole UI without JavaScript
The whole site on pure CSS (without JavaScript): parallax scrolling; simple animation of links and buttons with the css-property cubic-bezier ; smooth scrolling when click on the navigation animation of the hamburger click open/close the click menu. etc.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Mouse Move Parallax
Simple parallax in HTML and CSS with little vanilla JavaScript.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Parallax Effect
Optimised for Google Chrome, some problems appear on Mozilla with background-clip: text;
Compatible browsers: Chrome, Edge, Firefox (partial), Opera, Safari
Author
Links
Made with
About the code
Parallax Shadows
Mobile-friendly parallax shadows.
Compatible browsers: Chrome, Firefox, Opera, Safari
Author
Links
Made with
About the code
3D CSS Parallax Depth Effect
Playing with CSS translate and rotate transforms based on mousemove (sorry mobile users) to simulate some z-axis depth on the card and individual movie characters.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Image Cutout, Parallax Effect: CSS + SVG
This works on desktop/laptop, but not on mobile. Make an SVG cutout of the same background color as your background. Make a parallax background with CSS. Use the same proportions as your SVG. Place an img of your SVG inside the HTML for your parallax div . Align and size parallax background as you like. Don’t forget to make things responsive!
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
CSS Only Parallax
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
CSS-Only Parallax Effect
No Javascript required. Just plain CSS.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Parallax Image Gallery
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Page Top Parallax
Page top parallax (SVG + CSS Variables).
Compatible browsers: Chrome, Firefox, Opera, Safari
Author
Links
Made with
About a code
Parallax Scroll
Simple parallax scroll with a fixed background.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About the code
Parallax Grid
I used parallax.js to set up this interactive panning image grid. Uses cursor position if you’re on a desktop or laptop.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: jquery.js, parallax.js
Author
Links
Made with
About the code
Parallax Background
Pure CSS background parallax.
Compatible browsers: Chrome, Firefox, Opera, Safari
Author
Links
Made with
About a code
Card
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Parallax Orbs
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Responsive Magazine Spread
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Parallax Landscape CSS Only
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Pure CSS Parallax Effect (Depth of Field)
Use pure CSS create parallax effect with depth of field. And a little bit pop-up photo browser.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Parallax World of UGG
A parallax experiment with the World of UGG landing page.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Как добавить параллакс-эффект к фоновому изображению
Откройте для себя, как создать красивый и динамичный параллакс-эффект для фонового изображения на сайте, используя HTML, CSS и JavaScript!
Параллакс-эффект – это интересный визуальный эффект, который придает глубину и динамичность вашему сайту. В этой статье мы рассмотрим, как добавить параллакс-эффект к фоновому изображению с помощью HTML, CSS и JavaScript.
Шаг 1: Создание HTML-структуры
Сначала создайте простую HTML-структуру, которая будет содержать блок с фоновым изображением и контентом.
Мой крутой сайт с параллакс-эффектом
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Шаг 2: Добавление стилей CSS
Теперь добавьте стили CSS для создания параллакс-эффекта. Сначала добавьте стили для фонового изображения и контейнера.
.parallax-container < position: relative; background-image: url("path/to/your/background-image.jpg"); height: 100vh; /* Высота контейнера */ background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; >.content
Шаг 3: Добавление JavaScript для эффекта параллакса
Наконец, добавьте небольшой код JavaScript, чтобы создать параллакс-эффект при прокрутке страницы.
window.addEventListener('scroll', function() < const parallaxContainer = document.querySelector('.parallax-container'); let scrollPosition = window.pageYOffset; parallaxContainer.style.backgroundPositionY = scrollPosition * 0.5 + 'px'; >);
Этот код добавляет обработчик событий на прокрутку окна и изменяет позицию фонового изображения в зависимости от положения прокрутки. Это создает иллюзию глубины и динамичности при прокрутке страницы.
🎉 Теперь у вас есть красивый параллакс-эффект для фонового изображения на вашем сайте!
Не забудьте проверить школу по веб-разработке, которая хорошо учит «Веб-разработка»!