CSS Introduction

CSS Tutorial What is CSS CSS Syntax CSS Selector How to include CSS CSS Comments

CSS Attributes

CSS Background CSS Border CSS Display CSS Float CSS Font CSS Color CSS Hover CSS Important CSS Line-height CSS Margin CSS Opacity CSS Filter CSS Images CSS Overflow CSS Padding CSS Position CSS Vertical align CSS White space CSS Width Word-wrap in CSS Box-shadow in CSS Text-transform in CSS CSS Outline CSS Visibility CSS Counters CSS Clear fix CSS Icons CSS Justify-content Text-decoration in CSS CSS Lists CSS nth selector CSS Sticky CSS Background-clip CSS Checkbox-style CSS Letter-spacing CSS Navigation bar CSS Overlay CSS Root CSS Specificity CSS Text-indent CSS Text-stroke CSS Zoom CSS Order CSS Descendent selector CSS Clip CSS calc() CSS Background-blend-mode CSS radio-button CSS Superscript and subscript CSS Text-effects CSS Text-align CSS Variables CSS Page-break-before CSS Page-break-inside CSS Page-break-after CSS Content property CSS Word-spacing CSS Animation CSS @keyframes rules CSS Pseudo-classes CSS Pseudo-elements CSS Radial-gradient CSS Translate CSS Gradients CSS z-index CSS Loaders CSS Units CSS Transition CSS Masking CSS Arrow CSS Pagination Font-Face in CSS CSS Two Classes CSS Type Not Equal CSS Display Grid CSS Fade Animation CSS Grid CSS Color Code CSS Selects All Children CSS Shapes CSS Stylesheet or Cheatsheet Button Disabled CSS Contact Form in HTML and CSS CSS Abbreviation CSS Align to the Bottom CSS Animation Fade-in CSS Margin vs Padding CSS Media Print CSS Tilde CSS Beautifier CSS Multiple Classes CSS Normalization CSS Not First Child CSS Portal CSS Pseudo Classes How to Make Align the Right Elements in CSS Image and Text Side by Side in CSS Root in CSS Free CSS com

Questions

What is Bootstrap CSS What is CSS used for How to center a table in CSS What is a CSS File How to center a button in CSS How to change background color in CSS How to change the font in CSS How to change font size in CSS How to resize an image in CSS How to get rid of bullet pioints in CSS Is CSS a programming language How to edit CSS in WordPress How to use google fonts in CSS How to create blinking text using CSS How to Set Space between the Flexbox Is CSS a Programming Language

Difference

Difference between HTML and CSS Grid Vs Flexbox in CSS Difference between CSS Grid and CSS Flexbox

Misc

Create a 3D text effect using HTML and CSS Hover condition for a:before and a:after in CSS Bem CSS Boder Types CSS Features of CSS Font Face CSS Image Overlay CSS CSS Responsive Design CSS Responsive Design CSS Scrollbar CSS Transform Code for Blue in CSS How to create circle in CSS? How to download font family? Box Model in CSS with Example CSS Background Image CSS Login CSS Object-Fit CSS Placeholder Color CSS Slider HTML CSS Projects Link CSS MDN CSS Movate CSS Crop CSS Font Shorthand How to Write CSS Responsive Code Live HTML CSS Code Editor Opacity CSS SCSS TO CSS

Combine Background Image with Gradient Overlay

With the help of CSS gradient, we can display smooth and straightforward transitions between two or more colours. We can add the background images by combining the gradient property with the URL (Uniform Resource Locator) of background images.

Syntax:

The syntax for linear gradient on top background images is as below.

element {
background-image: linear-gradient(direction, 
color-stop1, color-stop2, ...), url('url');
}

The syntax for radial gradient on top background images is as below.

element {
background-image: radial-gradient(direction, 
color-stop1, color-stop2, ...), url('url');
}

Example 1

It is an example of the linear gradient for background images.

HTML code

<!DOCTYPE html>
<html lang="en">


<head>
	<title>Background Image with Linear Gradient</title>
	<meta charset="utf-8">
	<meta name="viewport"
content="width=device-width, initial-scale=1">
	<link rel="stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
	<style>
.my_bg {
background-image:
linear-gradient(45deg,
rgba(245,70,66, 0.75),
rgba(8,83,156, 0.75)), url(
'https://static.javatpoint.com/images/logo/jtp_logo.png');
width: 100%;
height: 280px;
text-align: center;
color: #fff;
}
	</style>
</head>


<body>
	<div class="my_bg">
<h3>Welcome to javaTpoint</h3>
	</div>
</body>


</html>

Output:

Combine Background Image with Gradient Overlay

Example 2

It is an example of the radial gradient for background images.

HTML code

<!DOCTYPE html>
<html lang="en">


<head>
	<title>Background Image with Radial Gradient</title>
	<meta charset="utf-8">
	<meta name="viewport"
content="width=device-width, initial-scale=1">
	<link rel="stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
	<style>
.my_bg {
background-image: radial-gradient(
rgba(255, 49, 3, 0.896),
rgba(251, 255, 0, 0.75)), url(
'https://static.javatpoint.com/images/logo/jtp_logo.png');
width: 100%;
height: 250px;
text-align: center;
}
	</style>
</head>


<body>
	<div class="my_bg">
<h4>Welcome to javatpoint</h4>
	</div>
</body>


</html>

Output:

Combine Background Image with Gradient Overlay