SlideShare a Scribd company logo
CSS Background
Image Tutorial With
Examples
This content was originally published at
https://www.blog.duomly.com/css-background-image-tutorial-with-examples/
***
The background image is probably one of
the CSS properties which all of us,
front-end developers, used at least a few
times in our careers. Most people think
that there can’t be anything unusual
about background-image, but after a quick
research, I have a different conclusion.
There are lots of questions asked about
CSS background image every day in
Facebook groups and lots of unknown
tricks which can help us to achieve
amazing effects and make stunning apps
and websites.
That’s the reason I decided to create
this article to show you what magic can
be done using such a simple CSS property.
I gathered seven tips and tricks I
believe will be the most useful and
create some code examples where you can
check what’s going on there for you.
And, if as usually if you don’t like
reading, jump to our Youtube channel for
a video version.
CSS background image on Youtube
Let’s check what’s behind the background!
1. How to fit a background image perfectly to a
viewport?
Let’s start from something that’s more
tip than a trick. How often it happened
to you that you had to struggle with your
background image to make in perfectly
fitted and not stretched and
unattractive?
Let me show you the way how to make your
background image always perfectly fitted
to your browser window!
https://codepen.io/duomly/pen/xxwYBOE
2. How to use multiple background images with CSS?
Hm, and what if I’d like to add more then
one image in the background?
That’s possible and not very difficult,
but can give a nice result while you’ve
got an idea to mix two graphics into
something beautiful.
I personally think that it’s super useful
when we want to add a pattern on the top
of a background image, so that’s what I
will show you in this example.
Let’s see how it works!
https://codepen.io/duomly/pen/eYpVoJR
3. How to create a triangular background image?
Another exciting CSS background image
trick is a triangular background image.
It creates a really beautiful effect,
especially when we would like to show
some totally different options like day
and night, or winter and summer.
It is done by creating two divs, both for
the full viewport, then it’s needed to
add a background image to both of them,
and next, the second div needs a clip-
path property to create a triangle shape.
Let’s see the code and result!
https://codepen.io/duomly/pen/RwWQmwW
4. How to add a gradient overlay to my background
image?
The fourth trick I’d like to show you in
this article is about overlay on the
background image.
It can be useful when you would like to
put some text on the image, but it’s too
light, and text is not visible, but it
can also improve the image itself.
For example, sunset images can be
strengthened by adding a pink-orange
gradient or red to transparent gradient.
Let’s see how we can easily add a
gradient overlay to the background image!
https://codepen.io/duomly/pen/rNOJgQE
5. How to create a color-changing background image
animation?
And what if you can decide which color is
the best as an overlay for your
background image? Then animations on
background images are really useful.
Using an animated overlay can give your
website a great final effect, and for
sure, people will remember it.
Let’s see what we can do using background
images and animations in CSS!
https://codepen.io/duomly/pen/gOavNOv
6. How to make a grid background image?
Sometimes it’s a great idea to go a
little bit more crazy, especially if the
project is about art or photography, then
a nice background image can be created
with CSS grid and CSS background image.
Oh, if you don’t know what’s CSS grid
check it out here.
Let’s take a look!
https://codepen.io/duomly/pen/MWaQNWb
7. How to set a background image as a text color?
Using background image with background-
clip you can achieve a beautiful effect
of the background image for text.
In some cases, it may be very useful,
especially when you’d like to create a
big text header, but not as boring as a
normal color.
Let’s see the stunning effect we can get!
https://codepen.io/duomly/pen/wvKyVjG
Conclusion on CSS background image
In this article, you could see 7
different tips and tricks to make amazing
things with the background image.
I’m pretty sure those hints will be
helpful and allow you to get amazing
results on your layouts. If you’d like to
check out some more interesting CSS tips
and tricks, check out our latest CSS
borders tips and tricks article and one
of the previous CSS tips and tricks.
If you have ever used any customized
solution for your background let me know
in the comments, I will be happy to find
out what more can be done with CSS
background image property.
Thank you for reading
Table of contents:
• 1. How to fit a background image
perfectly to a viewport?
• 2. How to use multiple background
images with CSS?
• 3. How to create a triangular
background image?
• 4. How to add a gradient overlay to my
background image?
• 5. How to create a color-changing
background image animation?
• 6. How to make a grid background
image?
• 7. How to set a background image as a
text color?
• Conclusion

More Related Content

What's hot

BUILD YOUR OWN WEBSITE
BUILD YOUR OWN WEBSITEBUILD YOUR OWN WEBSITE
BUILD YOUR OWN WEBSITE
Iskender Piyale-Sheard
 
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
GUST
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
Joe Querin
 
The ABCs of HTML
The ABCs of HTMLThe ABCs of HTML
The ABCs of HTML
Meagan Hanes
 
Frameworks for the web
Frameworks for the webFrameworks for the web
Frameworks for the web
netfuel
 
[wcatx] jQuery for WordPress Theme Designers
[wcatx] jQuery for WordPress Theme Designers[wcatx] jQuery for WordPress Theme Designers
[wcatx] jQuery for WordPress Theme Designers
Joel G Goodman
 
Railsgirls: Where did my HTML and CSS go
Railsgirls: Where did my HTML and CSS goRailsgirls: Where did my HTML and CSS go
Railsgirls: Where did my HTML and CSS go
Brigitte Jellinek
 
Theming Your Views
Theming Your ViewsTheming Your Views
Theming Your Views
Mark Jarrell
 
Introduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design ApplicationIntroduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design Application
eXo Platform
 
Visual Rhetoric March 21st, 2013
Visual Rhetoric March 21st, 2013Visual Rhetoric March 21st, 2013
Visual Rhetoric March 21st, 2013
Miami University
 
css and wordpress
css and wordpresscss and wordpress
css and wordpress
umesh patil
 
How To Theme: A Design Workflow for WordPress
How To Theme: A Design Workflow for WordPressHow To Theme: A Design Workflow for WordPress
How To Theme: A Design Workflow for WordPress
Joel G Goodman
 
How to manage a big scale HTML/CSS project
How to manage a big scale HTML/CSS projectHow to manage a big scale HTML/CSS project
How to manage a big scale HTML/CSS project
Renoir Boulanger
 
Wordpress Underscores & foundation5
Wordpress Underscores & foundation5Wordpress Underscores & foundation5
Wordpress Underscores & foundation5
Aum Watcharapol
 
Responsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for BeginnersResponsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for Beginners
Bootstrap Creative
 
Great ideas 4 your website
Great ideas 4 your websiteGreat ideas 4 your website
Great ideas 4 your website
Gonzalo Sánchez
 
THE WORDPRESS DASHBOARD DEMYSTIFIED
THE WORDPRESS DASHBOARD DEMYSTIFIEDTHE WORDPRESS DASHBOARD DEMYSTIFIED
THE WORDPRESS DASHBOARD DEMYSTIFIED
BobWP.com
 
WeBB MeetUp#1 Web applications caching techniques
WeBB MeetUp#1 Web applications caching techniquesWeBB MeetUp#1 Web applications caching techniques
WeBB MeetUp#1 Web applications caching techniques
Maciej Grajcarek
 
How to use to build a website using WordPress: For normal people
How to use to build a website using WordPress: For normal peopleHow to use to build a website using WordPress: For normal people
How to use to build a website using WordPress: For normal people
Tris Hussey
 
Setting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a ProSetting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a Pro
Nile Flores
 

What's hot (20)

BUILD YOUR OWN WEBSITE
BUILD YOUR OWN WEBSITEBUILD YOUR OWN WEBSITE
BUILD YOUR OWN WEBSITE
 
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
Asia Ryćko, Agnieszka Sekuła: Typography online | BachoTeX 2015
 
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015WP 201   Custom Post Types - Custom Fields - WordCamp Columbus 2015
WP 201 Custom Post Types - Custom Fields - WordCamp Columbus 2015
 
The ABCs of HTML
The ABCs of HTMLThe ABCs of HTML
The ABCs of HTML
 
Frameworks for the web
Frameworks for the webFrameworks for the web
Frameworks for the web
 
[wcatx] jQuery for WordPress Theme Designers
[wcatx] jQuery for WordPress Theme Designers[wcatx] jQuery for WordPress Theme Designers
[wcatx] jQuery for WordPress Theme Designers
 
Railsgirls: Where did my HTML and CSS go
Railsgirls: Where did my HTML and CSS goRailsgirls: Where did my HTML and CSS go
Railsgirls: Where did my HTML and CSS go
 
Theming Your Views
Theming Your ViewsTheming Your Views
Theming Your Views
 
Introduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design ApplicationIntroduce Bootstrap 3 to Develop Responsive Design Application
Introduce Bootstrap 3 to Develop Responsive Design Application
 
Visual Rhetoric March 21st, 2013
Visual Rhetoric March 21st, 2013Visual Rhetoric March 21st, 2013
Visual Rhetoric March 21st, 2013
 
css and wordpress
css and wordpresscss and wordpress
css and wordpress
 
How To Theme: A Design Workflow for WordPress
How To Theme: A Design Workflow for WordPressHow To Theme: A Design Workflow for WordPress
How To Theme: A Design Workflow for WordPress
 
How to manage a big scale HTML/CSS project
How to manage a big scale HTML/CSS projectHow to manage a big scale HTML/CSS project
How to manage a big scale HTML/CSS project
 
Wordpress Underscores & foundation5
Wordpress Underscores & foundation5Wordpress Underscores & foundation5
Wordpress Underscores & foundation5
 
Responsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for BeginnersResponsive Web Design Tutorial PDF for Beginners
Responsive Web Design Tutorial PDF for Beginners
 
Great ideas 4 your website
Great ideas 4 your websiteGreat ideas 4 your website
Great ideas 4 your website
 
THE WORDPRESS DASHBOARD DEMYSTIFIED
THE WORDPRESS DASHBOARD DEMYSTIFIEDTHE WORDPRESS DASHBOARD DEMYSTIFIED
THE WORDPRESS DASHBOARD DEMYSTIFIED
 
WeBB MeetUp#1 Web applications caching techniques
WeBB MeetUp#1 Web applications caching techniquesWeBB MeetUp#1 Web applications caching techniques
WeBB MeetUp#1 Web applications caching techniques
 
How to use to build a website using WordPress: For normal people
How to use to build a website using WordPress: For normal peopleHow to use to build a website using WordPress: For normal people
How to use to build a website using WordPress: For normal people
 
Setting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a ProSetting Up your WordPress Site like a Pro
Setting Up your WordPress Site like a Pro
 

Similar to Css background image

Css border examples
Css border examplesCss border examples
Css border examples
💾 Radek Fabisiak
 
Css masterclass book
Css masterclass bookCss masterclass book
Css masterclass book
Phoenix
 
6 Methods to use page scroll animation.pdf
6 Methods to use page scroll animation.pdf6 Methods to use page scroll animation.pdf
6 Methods to use page scroll animation.pdf
Be Problem Solver
 
Design and CSS
Design and CSSDesign and CSS
Design and CSS
nolly00
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blog
igorgentry
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practices
nolly00
 
CSS_GUIDE_Intro
CSS_GUIDE_IntroCSS_GUIDE_Intro
CSS_GUIDE_Intro
tutorialsruby
 
CSS_GUIDE_Intro
CSS_GUIDE_IntroCSS_GUIDE_Intro
CSS_GUIDE_Intro
tutorialsruby
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflows
nolly00
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
Domestic Equity Studio
 
Divs and Links Styles
Divs and Links StylesDivs and Links Styles
Divs and Links Styles
Daniel Downs
 
Enhance Enhance
Enhance EnhanceEnhance Enhance
Enhance Enhance
Andy Parker
 
Introduction to Responsive Design v.2
Introduction to Responsive Design v.2Introduction to Responsive Design v.2
Introduction to Responsive Design v.2
Clarissa Peterson
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
Sanjoy Kr. Paul
 
Reworking our-workflows
Reworking our-workflowsReworking our-workflows
Reworking our-workflows
nolly00
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails Apps
Netguru
 
Basic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligetiBasic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligeti
Naveen Kumar Veligeti
 
PSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS WayPSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS Way
Emma Jane Hogbin Westby
 
Http _css-tricks
Http  _css-tricksHttp  _css-tricks
Http _css-tricks
Daniel Downs
 
7 crazy tips that will help you
7 crazy tips that will help you7 crazy tips that will help you
7 crazy tips that will help you
Jessica Wilson
 

Similar to Css background image (20)

Css border examples
Css border examplesCss border examples
Css border examples
 
Css masterclass book
Css masterclass bookCss masterclass book
Css masterclass book
 
6 Methods to use page scroll animation.pdf
6 Methods to use page scroll animation.pdf6 Methods to use page scroll animation.pdf
6 Methods to use page scroll animation.pdf
 
Design and CSS
Design and CSSDesign and CSS
Design and CSS
 
Installing And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blogInstalling And Configuration for your Wordpress blog
Installing And Configuration for your Wordpress blog
 
CSS Best Practices
CSS Best PracticesCSS Best Practices
CSS Best Practices
 
CSS_GUIDE_Intro
CSS_GUIDE_IntroCSS_GUIDE_Intro
CSS_GUIDE_Intro
 
CSS_GUIDE_Intro
CSS_GUIDE_IntroCSS_GUIDE_Intro
CSS_GUIDE_Intro
 
Exploring Our Front-End Workflows
Exploring Our Front-End WorkflowsExploring Our Front-End Workflows
Exploring Our Front-End Workflows
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
Divs and Links Styles
Divs and Links StylesDivs and Links Styles
Divs and Links Styles
 
Enhance Enhance
Enhance EnhanceEnhance Enhance
Enhance Enhance
 
Introduction to Responsive Design v.2
Introduction to Responsive Design v.2Introduction to Responsive Design v.2
Introduction to Responsive Design v.2
 
Structuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSSStructuring your CSS for maintainability: rules and guile lines to write CSS
Structuring your CSS for maintainability: rules and guile lines to write CSS
 
Reworking our-workflows
Reworking our-workflowsReworking our-workflows
Reworking our-workflows
 
OOScss Architecture For Rails Apps
OOScss Architecture For Rails AppsOOScss Architecture For Rails Apps
OOScss Architecture For Rails Apps
 
Basic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligetiBasic CSS concepts by naveen kumar veligeti
Basic CSS concepts by naveen kumar veligeti
 
PSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS WayPSD to Theme: The SMACSS Way
PSD to Theme: The SMACSS Way
 
Http _css-tricks
Http  _css-tricksHttp  _css-tricks
Http _css-tricks
 
7 crazy tips that will help you
7 crazy tips that will help you7 crazy tips that will help you
7 crazy tips that will help you
 

More from 💾 Radek Fabisiak

Html projects for beginners
Html projects for beginnersHtml projects for beginners
Html projects for beginners
💾 Radek Fabisiak
 
Javascript for loop
Javascript for loopJavascript for loop
Javascript for loop
💾 Radek Fabisiak
 
Python faster for loop
Python faster for loopPython faster for loop
Python faster for loop
💾 Radek Fabisiak
 
Node js projects
Node js projectsNode js projects
Node js projects
💾 Radek Fabisiak
 
Button hover effects
Button hover effectsButton hover effects
Button hover effects
💾 Radek Fabisiak
 
React projects for beginners
React projects for beginnersReact projects for beginners
React projects for beginners
💾 Radek Fabisiak
 
Slicing in Python - What is It?
Slicing in Python - What is It?Slicing in Python - What is It?
Slicing in Python - What is It?
💾 Radek Fabisiak
 
The best programming languages for blockchain
The best programming languages for blockchainThe best programming languages for blockchain
The best programming languages for blockchain
💾 Radek Fabisiak
 

More from 💾 Radek Fabisiak (8)

Html projects for beginners
Html projects for beginnersHtml projects for beginners
Html projects for beginners
 
Javascript for loop
Javascript for loopJavascript for loop
Javascript for loop
 
Python faster for loop
Python faster for loopPython faster for loop
Python faster for loop
 
Node js projects
Node js projectsNode js projects
Node js projects
 
Button hover effects
Button hover effectsButton hover effects
Button hover effects
 
React projects for beginners
React projects for beginnersReact projects for beginners
React projects for beginners
 
Slicing in Python - What is It?
Slicing in Python - What is It?Slicing in Python - What is It?
Slicing in Python - What is It?
 
The best programming languages for blockchain
The best programming languages for blockchainThe best programming languages for blockchain
The best programming languages for blockchain
 

Recently uploaded

openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 

Recently uploaded (20)

openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 

Css background image

  • 2. This content was originally published at https://www.blog.duomly.com/css-background-image-tutorial-with-examples/ *** The background image is probably one of the CSS properties which all of us, front-end developers, used at least a few times in our careers. Most people think that there can’t be anything unusual about background-image, but after a quick research, I have a different conclusion. There are lots of questions asked about CSS background image every day in Facebook groups and lots of unknown tricks which can help us to achieve amazing effects and make stunning apps and websites. That’s the reason I decided to create this article to show you what magic can be done using such a simple CSS property. I gathered seven tips and tricks I believe will be the most useful and create some code examples where you can check what’s going on there for you. And, if as usually if you don’t like reading, jump to our Youtube channel for a video version.
  • 3. CSS background image on Youtube Let’s check what’s behind the background!
  • 4. 1. How to fit a background image perfectly to a viewport? Let’s start from something that’s more tip than a trick. How often it happened to you that you had to struggle with your background image to make in perfectly fitted and not stretched and unattractive? Let me show you the way how to make your background image always perfectly fitted to your browser window! https://codepen.io/duomly/pen/xxwYBOE
  • 5. 2. How to use multiple background images with CSS? Hm, and what if I’d like to add more then one image in the background? That’s possible and not very difficult, but can give a nice result while you’ve got an idea to mix two graphics into something beautiful. I personally think that it’s super useful when we want to add a pattern on the top of a background image, so that’s what I will show you in this example. Let’s see how it works! https://codepen.io/duomly/pen/eYpVoJR
  • 6. 3. How to create a triangular background image? Another exciting CSS background image trick is a triangular background image. It creates a really beautiful effect, especially when we would like to show some totally different options like day and night, or winter and summer. It is done by creating two divs, both for the full viewport, then it’s needed to add a background image to both of them, and next, the second div needs a clip- path property to create a triangle shape. Let’s see the code and result! https://codepen.io/duomly/pen/RwWQmwW
  • 7. 4. How to add a gradient overlay to my background image? The fourth trick I’d like to show you in this article is about overlay on the background image. It can be useful when you would like to put some text on the image, but it’s too light, and text is not visible, but it can also improve the image itself. For example, sunset images can be strengthened by adding a pink-orange gradient or red to transparent gradient. Let’s see how we can easily add a gradient overlay to the background image! https://codepen.io/duomly/pen/rNOJgQE
  • 8. 5. How to create a color-changing background image animation? And what if you can decide which color is the best as an overlay for your background image? Then animations on background images are really useful. Using an animated overlay can give your website a great final effect, and for sure, people will remember it. Let’s see what we can do using background images and animations in CSS! https://codepen.io/duomly/pen/gOavNOv
  • 9. 6. How to make a grid background image? Sometimes it’s a great idea to go a little bit more crazy, especially if the project is about art or photography, then a nice background image can be created with CSS grid and CSS background image. Oh, if you don’t know what’s CSS grid check it out here. Let’s take a look! https://codepen.io/duomly/pen/MWaQNWb
  • 10. 7. How to set a background image as a text color? Using background image with background- clip you can achieve a beautiful effect of the background image for text. In some cases, it may be very useful, especially when you’d like to create a big text header, but not as boring as a normal color. Let’s see the stunning effect we can get! https://codepen.io/duomly/pen/wvKyVjG
  • 11. Conclusion on CSS background image In this article, you could see 7 different tips and tricks to make amazing things with the background image. I’m pretty sure those hints will be helpful and allow you to get amazing results on your layouts. If you’d like to check out some more interesting CSS tips and tricks, check out our latest CSS borders tips and tricks article and one of the previous CSS tips and tricks. If you have ever used any customized solution for your background let me know in the comments, I will be happy to find out what more can be done with CSS background image property. Thank you for reading Table of contents: • 1. How to fit a background image perfectly to a viewport? • 2. How to use multiple background images with CSS? • 3. How to create a triangular background image? • 4. How to add a gradient overlay to my background image?
  • 12. • 5. How to create a color-changing background image animation? • 6. How to make a grid background image? • 7. How to set a background image as a text color? • Conclusion