CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress
CSS Tutorials

Overview

The CSS background properties are used to add backgrounds and background effects to the HTML page and HTML elements.

Background Color

The background-color property sets the background color of the entirety of an element.

				
					div {
    background-color: red;
}
				
			

Background Image

The background-image property sets one or more background images (with varying placement) for an element. The default placement is at the top-left corner.

				
					div {
    background-image: url("my-background.jpg");
}
				
			

Setting the Image Size, Repeat, and Position

The background-size property specifies the size of the background image. By default an image that doesn’t fill the element will repeat both vertically and horizontally starting from the top, left position. This can be changed.

				
					div {
    background-image: url("my-background.jpg");
    background-size: 400px 200px;
    background-repeat: no-repeat;
    background-positon: right center;
}
				
			

Background Gradient

CSS lets you create smooth gradients between two or more specified colors.

Linear Gradient

				
					div {
  height: 100px;
  background-color: red; /* default for browsers that don't support gradients */
  background-image: linear-gradient(to right, red , blue);
}
				
			

Radial Gradient

				
					div {
  height: 100px;
  background-color: red; /* default for browsers that don't support gradients */
  background-image: radial-gradient(red, blue, green);
}
				
			

Conic Gradient

				
					div {
  height: 100px;
  background-color: red; /* default for browsers that don't support gradients */
  background-image: conic-gradient(red, yellow, blue, green);
}
				
			

Background Properties

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.