Home Web Front-end CSS Tutorial CSS Syntax Manual (5) Color and Background Properties

CSS Syntax Manual (5) Color and Background Properties

Dec 19, 2016 pm 04:16 PM
background properties color

1. color

Function: Set the color of the foreground or element.
Numerical: Use color keywords or RGB values.
Example:


Text color (keyword)

Text color (#rrggbb)

Text color [rgb(rr,gg,bb)]

Text color [rgb(r%,g%,b %)]

2. background-color

Function: Set the background color of the page or page element.
Value:
Color - Available color name or RGB value
transparent - Transparent, make the page background the default background.
Example:


Background color

3. background-image

Function: Define background graphics.
Value:
none - do not use graphics as background
url - provide the URL address of the graphics file
Note: You can also include the background-color attribute to use when the graphics cannot be found
Example:


Graphic background

4 , background-repeat

Function: Control whether the graphic background is repeated.
Value:
repeat - vertical and horizontal repeat, default value
repeat-x - horizontal repeat
repeat-y - vertical repeat
no-repeat - no repeat
Description: This attribute is together with the background-image and background-position attributes use.
Example:


Horizontal repeat arrangement

5. background-attachment

Function: Specify whether the background of the element scrolls with the element or is fixed at a certain position on the page.
Value:
scroll - scrolls with the element
fixed - fixed
Description:
The default value is scroll, this attribute is used together with the background-image attribute.

6. background-position

Function: Used to position the element background in space
Value:
Length - Set the starting point of the edge of the element box in relative or absolute units and give the coordinates in the unit.
Percentage - Used as a percentage to indicate the position on the edge of the box where the browser will start placing the image. This value can be repeated to also provide vertical and horizontal starting points
Vertical position - sets the starting point in the vertical direction, the keywords are top, center, bottom
Horizontal position - sets the starting point in the horizontal direction, the keywords left, center, right
For example: top left, left top and 0% 0% all mean that the upper left corner of the graphic starts from the upper left corner of the element box. Example:


Body {background-image:url(logo.gif); background-position:50% 50%}

This statement sets the Body basic class to the background graphic to be displayed in the center of the page.

7. background

Function: Abbreviation attribute, you can set all background attributes.

Values:
background-attachment
background-color
background-image
background-position
background-repeat
See the individual properties section for details on the above values.

The above is the content of CSS Grammar Manual (5) Color and Background Properties. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to change title bar color on Windows 11? How to change title bar color on Windows 11? Sep 14, 2023 pm 03:33 PM

By default, the title bar color on Windows 11 depends on the dark/light theme you choose. However, you can change it to any color you want. In this guide, we'll discuss step-by-step instructions for three ways to change it and personalize your desktop experience to make it visually appealing. Is it possible to change the title bar color of active and inactive windows? Yes, you can change the title bar color of active windows using the Settings app, or you can change the title bar color of inactive windows using Registry Editor. To learn these steps, go to the next section. How to change title bar color in Windows 11? 1. Using the Settings app press + to open the settings window. WindowsI go to "Personalization" and then

How to Invert Colors on Windows 11 [Using Shortcuts] How to Invert Colors on Windows 11 [Using Shortcuts] Apr 14, 2023 pm 02:43 PM

When using a Windows computer, you may need to invert the computer's colors. This may be due to personal preference or a display driver error. If you want to invert the colors on your Windows 11 PC, this article provides you with all the necessary steps to invert the colors on your Windows PC. What does it mean to invert colors on an image in this article? Simply put, inverting the colors of an image means flipping the current color of the image to the opposite hue on the color wheel. You can also say this means changing the color of the image to a negative. For example, a blue image will be inverted to orange, black to white, green to magenta, etc. How to invert colors on Windows 11? 1. Use the Microsoft Paint button + and enter

Natural Titanium: Revealing the True Color of iPhone 15 Pro Natural Titanium: Revealing the True Color of iPhone 15 Pro Sep 18, 2023 pm 02:13 PM

With its annual Wanderlust event over, Apple has finally put to rest months of rumors and speculation about its iPhone 15 lineup. As expected, its 2023 flagship "Pro" model sets itself apart in terms of raw power and new "Titanium" design and aesthetics. Here's a look at the different colors of the new iPhone 15 Pro models, and to determine the true colors and shades of the "natural titanium" variant. Apple iPhone 15 Pro Color Apple has chosen grade 5 titanium alloy as the material design for the latest iPhone 15 Pro model. The titanium alloy used on the iPhone 15 Pro is known for its strength-to-weight ratio, which not only makes it more durable and lightweight, but also gives the device an elegant "brush" texture that

Detailed tutorial on how to set the eye protection color application on win10 computer Detailed tutorial on how to set the eye protection color application on win10 computer Jul 08, 2023 am 10:46 AM

For office workers, working on the computer lasts all day, and the background color of most software is pure white. If you look at it for a long time, your eyes will feel dry and uncomfortable. In fact, we can customize the window eye protection color. The method introduced online is more troublesome to operate. In this article, the editor will share with you a method to adjust the window eye protection color in Win10. Let’s take a look at how to set the computer eye protection mode. 1. First, press the key combination [win] + [R] on the keyboard to open the run window, enter [regedit] and click OK to open. 2. Then expand the registry folder in sequence: [\HKEY_CURRENT_USER\ControlPanel\Colors] 3. Then in the Colors folder

Do you know how to set the color of WPS document table? Do you know how to set the color of WPS document table? Mar 20, 2024 am 08:19 AM

When we see the table colors in other people's WPS documents, the effects are colorful and beautiful; but we only have monotonous black. If you have to fill the table with colors, I believe many students will do it. However, if you want to set the color of the table in WPS document China, many students will definitely find it confusing! Today, let’s learn how to set the color of the WPS document table. I have put together a document that I hope will be helpful to everyone. The steps are as follows: 1. We need to draw a table in the WPS document and right-click the table where the line color is to be modified. 2. Next, use the mouse to click [right mouse button] on the table; in the pop-up menu, we find [Border and Shading]. 3. At this time, the [Border and Shading] option will be opened.

How to change the color of the Windows 10 taskbar How to change the color of the Windows 10 taskbar Jan 01, 2024 pm 09:05 PM

It is very simple to modify the taskbar color in Windows 10, but many users find that they cannot set it. In fact, it is very simple. Just choose your favorite color in the personalization of the computer. If you cannot change the color, pay attention to the detailed settings. How to change the color of the win10 taskbar Step 1: Right-click on the desktop - click Personalize Step 2: Customize the color area Step 3: Choose your favorite color PS: If you cannot change the color, you can click Color -> Select Color -> Customize->Default windows mode, select dark color.

Vivo's new X100 series memory, color exposure: all series start at 12+256GB Vivo's new X100 series memory, color exposure: all series start at 12+256GB May 06, 2024 pm 03:58 PM

According to news on May 6, vivo officially announced today that the new vivoX100 series will be officially released at 19:00 on May 13. It is understood that this conference is expected to release three models, vivoX100s, vivoX100sPro, and vivoX100Ultra, as well as vivo's self-developed imaging brand BlueImage blueprint imaging technology. Digital blogger "Digital Chat Station" also released the official renderings, memory specifications and color matching of these three models today. Among them, X100s adopts a straight screen design, while X100sPro and X100Ultra have curved screen designs. The blogger revealed that vivoX100s comes in four colors: black, titanium, cyan, and white. The memory specifications

How to solve the abnormal color problem of Win7 monitor How to solve the abnormal color problem of Win7 monitor Jan 14, 2024 pm 06:54 PM

We know that computers will have various problems after being used for a long time. The most common one is the monitor problem. Many users have encountered abnormal monitor colors. So what should you do if you also encounter abnormal monitor colors in Win7? Yes, let’s take a look at the solution. What to do if the Win7 monitor has abnormal colors: Common monitor failure phenomena are as follows: 1. There is no display when turning on the computer, and the monitor often does not power on. 2. The characters on the monitor screen are blurry. 3. The monitor has color spots. 4. Wavy colored stripes appear on the monitor. 5. The monitor has a peculiar smell. 6. There is a continuous "pop" sound from the monitor. 7. Under certain applications or configurations, the screen may become blurry, dark (or even black), ghosted, or frozen, etc. 8. The display lacks color, is defocused, the screen is too bright, or

See all articles