How to set multiple background properties in one declaration

Example analysis:

The background attribute is a shorthand attribute that can set all background attributes in one statement.

The attributes that can be set are: background-color, background-position, background-size, background-repeat, background-origin , background-clip, background-attachment, and background-image.

It doesn’t matter if one of the above values ​​is missing, for example, background: #FF0000 URL (smiley.gif); is allowed .






#

Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> <style> body { background:#ffffff url('https://img.php.cn/upload/article/000/000/015/5c6ba8b3a7ee3101.png') no-repeat right top; margin-right:200px; } </style> </head> <body> <h1>Hello World!</h1> <p>背景图片只显示一次,但它位置离文本比较远。</p> <p>在这个例子中我们添加了一个右边距,所以背景图像不会打扰到文本。</p> </body> </html>
submitReset Code