The CSS background properties should be used to set the background effects for elements.

The CSS background properties are of FIVE types:

1. background-color

2. background-image

3. background-repeat

4. background-position

5. background-attachment

— — — — — — — — — — — — — — — — — — — — — — — — —

1. background-color

background-color: green;

2. background-image

background-image: url(“owl_tree.png”);

3. background-repeat

background-repeat: repeat; (or) background-repeat: no-repeat;

4. background-position

background-position: right; (or) background-position: left;

5. background-attachment

background-attachment: fixed; (or) background-attachment: scroll;

Source Code:

<!DOCTYPE html>

<html>

<head>

<style>

body {

background-color: green;

background-image: url(“img_tree.png”);

background-repeat: no-repeat;

background-position: right;

background-attachment: fixed;

}

</style>

</head>

<body>

<h1>All about CSS Backgrounds</h1>

<p>The background properties should be defined inside the body element.</p>

</body>

</html>

Output:


Colors can be defined using predefined color names, RGB, HSL, HEX values.

RGB — Red Green Blue | RGB Values: rgb(255, 154, 102)

HSL — Hue Saturation Lightness | HSL Values: hsl(286, 69%, 67%)

HEX — Hexadecimal | HEX Values: #ff9a45

Source Code:

<!DOCTYPE html>

<html>

<body>

<h1 style=”background-color: Red;”>Example 1 — Color Name</h1>

<p style=”color: red;”>Hey..</p>

<h1 style=”background-color: rgb(255, 154, 102);”>Example 2 — RGB Values</h1>

<p style=”color: rgb(255, 154, 102);”>Good to see you..</p>

<h1 style=”background-color: hsl(286, 69%, 67%);”>Example 3 — HSL Values</h1>

<p style=”color: hsl(286, 69%, 67%);”>Learn about CSS colors..</p>

<h1 style=”background-color: #ff9a45;”>Example 4 — HEX Values</h1>

<p style=”color: #ff9a45;”>Practice..Practice..Practice..</p>

</body>

</html>

Output:


  • Comments are generally used to explain the source code and also help the developers to edit the source code at a later stage.
  • Comments are neglected by browsers.
  • A Cascading Style Sheets (CSS) comment is placed inside the <style> element, and starts with /* and ends with */.

Source Code:

<!DOCTYPE html>

<html>

<head>

<style>

p {

color: blue; /* Set text color to blue */

}

</style>

</head>

<body>

<h2>This is Heading</h2>

<p>Hello Reader!</p>

<p>Comments are not displayed in the output.</p>

</body>

</html>

Output:


Cascading Style Sheets (CSS) selectors are used for selecting the content you want to style. Selectors are one of the parts of the CSS ruleset. CSS selectors select HTML elements according to its class, type, id, attribute, etc.

Different types of selectors in CSS:

1. CSS ID Selector

2. CSS Element Selector

3. CSS Universal Selector

4. CSS Class Selector

5. CSS Group Selector

— — — — — — — — — — — — — — — — — — — — — — — — — —

1. CSS ID Selector

Source Code:

<!DOCTYPE html>

<html>

<head>


A Cascading Style Sheet (CSS) rule-set contains a selector and a declaration block.

The selector denotes to the HTML element you want to style. The declaration block denotes one or more declarations separated by semicolons. For each declaration, there will be a name and a value, separated by a colon. Multiple declarations are separated with semicolons, and declaration blocks should surround by curly braces.

Example 1

h1 {
color: blue;
text-align: right;
}

Example 2

p {
color: black;
font-size: 18px;
}

Example 3

p {
color: green;
font-size: 18px;

text-align: center;
}


About CSS:

CSS stands for Cascading Style Sheets. CSS is a style sheet language used for defining the presentation of a document written in a markup language like HyperText Markup Language (HTML). CSS defines how HTML code is going to look on a website.

CSS is designed to enable the division of content and presentation, including fonts, colors, and layouts. This division can provide more flexibility, improve content accessibility, and control in the specification of presentation features.

History of CSS:

The Cascading Style Sheets (CSS) specifications are maintained by the World Wide Web Consortium (W3C). CSS is developed by Hakon…


What is WiFi?

WiFi is the short form of Wireless Fidelity. It is a wireless networking technology that allows devices such as desktops, laptops, wearables, mobile devices, printers, and video cameras to interface with the Internet. WiFi uses electromagnetic waves at radio frequencies for data transmission.

  • WiFi has 20 meters — 100 meters range.
  • It is a point to multipoint network.
  • The speed range is 25 Mbps — 600 Mbps.
  • It is based on the 802.11 IEEE standard.
  • High capacity load balancing.

What is LiFi?

LiFi is the short form of Light Fidelity. It is a light communication system that…


In today’s world, everything has relied on data, and securing these data is the main concern. Especially, passwords are there to keep the data safe and secure that we upload on the Internet. The passwords which are simple can be hacked easily and all the personal information can be misused. In order to stop such things and keep the data safe, it is absolutely necessary to keep the passwords very strong.

The main aspects of a strong password are length (the longer the better), a mix of letters (upper case and lower case), symbols, numbers, and no dictionary words.

There…


What is Python?

Python is an interpreted, high-level, general-purpose programming language. It is created by Guido van Rossum and first released in 1991. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

Pros:

  • Easy to learn.
  • Supports multiple systems and platforms.
  • It supports Object-Oriented Programming (OOP).
  • Many inbuilt libraries.
  • It is used in web development.
  • Most popular and used everywhere nowadays.
  • It allows scaling even the most complex applications with ease.

Cons:

  • Python is slow.
  • It is not a good choice for memory-intensive tasks.
  • It is not a very good…


What is Bootstrap?

Bootstrap is a free and open-source CSS framework directed at responsive, mobile-first front-end web development. It is developed by Mark Otto and Jacob Thornton, released on 19 August 2011. Bootstrap has 142k stars on GitHub.

  • Bootstrap is written in HTML, CSS, sass(v4), and JavaScript.
  • Bootstrap is used to develop responsive websites.
  • It is a front-end framework.
  • It is used for designing User Interface (UI) of the website.
  • There is a gird system to adjust the webpages on different sections of the website.
  • Search Engine Optimization (SEO) is not provided by Bootstrap.

What is WordPress?

WordPress is a…

Akash Rao Mallareddy

Web Developer, Blogger, Start Up Enthusiastic, Leader

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store