background-color会填充内容、内边距和边框以内(到边框内边缘)的区域。 透明边框:如果边框是透明的 (例如border: 1px solid transparent;),那么background-color会延伸到边框区域,看起来像是填充了边框。 背景图片 (background-image):如果同时设置了背景图片 (background-image),background-color会在背景图片的下方显...
在前端开发中,当你给一个元素设置background-color属性时,这个颜色会填充该元素的整个内容区域(content area),包括其内边距(padding)区域,但不包括边框(border)和外边距(margin)区域。 这里是一个简单的示例来说明这个概念: <!DOCTYPEhtml>Background Color Example.box{width:200px;height:200px;padding:20px;bord...
1. 属性background-color 背景颜色会填充整个标签,它的定义方式有三种,即颜色英文单词的方式定义,16进制颜色值定义,rgb的模式定义。 第一种背景色定义方式使用颜色的英文单词的方式,如red(红色),blue(蓝色),green(绿色), white(白色),black(黑色) 等等,例如: background-color属性 第二种背景色定义方式使用16进...
background-color用来描述设置填充背景的颜色。有多种方法来定义确定填充的颜色,下列方法都是等效的: 复制 background-color:blue;background-color:rgb(0,0,255);background-color:#0000ff; 1. 2. 3. background-color 也能设置成transparent,这样就能让其下的元素显示出来。 Background image属性 background-i...
1 background-color : 为元素设置背景颜色,会填充元素的内容、内边距、边框。如果边框有透明部分,会透过这些透明部分显示出背景色 值: color_name 如:red hex_number 如:#f00 rgb_number 如:rgb(0,0,0) transparent 默认,透明 inherit 继承父元素
background-color:#ff99ff;设置元素的背景颜色。 background-image:url(images/2.gif);将图像设置为背景。 background-repeat: no-repeat;设置背景图片是否重复及如何重复,默认平铺满。(重要) no-repeat不要平铺; repeat-x横向平铺; repeat-y纵向平铺。
1. background-color 设置一个元素的背景颜色 元素的背景颜色是元素的总大小,包括填充和边界(但不包括边距) background-color: #f00 等同于 background: #f00; 默认值是transparent, 可设置十六进制颜色,RGB颜色,RGBA颜色, HSL色彩, HSLA颜色 2. background-image 设置一个元素的背景图像 ...
一、背景:background。 设置对象的背景特性。一个元素可以设置多重背景图像,每组之间用逗号隔开,如果存在重叠关系,前面的背景图像会覆盖在后面背景图上。 1.background-color:指定背景的颜色。取值:正常的颜色取值。 2.background-image:背景图片。如果设置了这个属性,最好也添加下background-color ,用于当背景image不...
1、bgcolor:规定页面的背景颜色。2、background-color:设置元素的背景颜色。三、特点不同 1、bgcolor:bgcolor属性标志HTML文档的背景颜色,在 HTML 4.01 中,不赞成使用 body 元素的 bgcolor 属性。2、background-color:为元素设置一种纯色。这种颜色会填充元素的内容、内边距和边框区域,扩展到元素...