目录

background

描述 (Description)

background是一个用于设置元素背景样式的简写元素。

可能的值 (Possible Values)

背景是一种速记属性,代表以下内容。 该值将根据实际属性而有所不同。

  • background-color - 为元素的背景,填充和边框背景设置纯色。

  • background-image - 定义要放置在元素background-image的位置。

  • background-repeat - 为元素背景中的图像设置重复方向。

  • background-attachment - 为元素背景中的任何图像设置附件状态。

  • background-position - 在元素的背景中设置原始图像的位置。

  • background-clip - 指定背景图像的绘制区域

适用于 (Applies to)

所有HTML元素。

DOM语法 (DOM Syntax)

object.style.background = "Value according to the used property";

例子 (Example)

<html>
   <head>
   </head>
   <body>
      <p <b class="notranslate">style = "background:url(/images/logo.png) repeat fixed;"</b>>
         This paragraph has fixed repeated background image. 
         This paragraph has fixed repeated background image. 
         This paragraph has fixed repeated background image. 
         This paragraph has fixed repeated background image.
      </p>
   </body>
</html> 

它会产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018