CSS HTML Javascript jQuery Ajax PHP Example Java MORE

CSS Colors

CSS colors are used to change the text, border, background color for an HTML page. It is defined using predefined color names or RGB, HEX, HSL, RGBA, HSLA values.

CSS text colors:

We can change the text color of an HTML element using a color attribute.

Example:

CSS Background Colors:

We can change the background colors of an HTML element using background-color property.

Example:

CSS Border Colors:

We can set the border-color using border attribute.

Example:

CSS Background

The CSS background property is used to define the background effect of an HTML element. There is 5 CSS background property that used to change the background property.

  1. background-color
  2. background-image
  3. background-repeat
  4. background-attachment
  5. background-position

CSS background-color

CSS background-color is used to change the background color of an HTML element.

CSS background-image

The background-image property is used to add a background image of an HTML element.

CSS background-repeat

By default, the background-image property repeats the background image horizontally and vertically. Some images are repeated only horizontally or vertically.

The background looks better if the image repeated horizontally only.

CSS background-attachment

The background-attachment property is used to define that the background image is fixed or scroll with the rest of the page in the browser window. If you set fixed the background image then the image will not move during scrolling in the browser.

CSS background-position

The background-position property is used to specify the initial position of the background image. The background image is placed on the top-left of the webpage by default.

    You can set the following positions:
  1. center
  2. top
  3. bottom
  4. left
  5. right

CSS Border

The CSS border is used to set a border for an HTML element. The CSS border specifying the style, color, size of the border.

    The CSS border properties are given below
  1. border-style
  2. border-color
  3. border-width
  4. border-radius