document.body.style.backgroundColor="#f3f3f3"; 尝试一下 » 定义和用法 backgroundColor 属性设置或返回元素的背景颜色。 浏览器支持 所有主要浏览器都支持 backgroundColor 属性。 注意:IE7 及更早的版本不支持 "inherit" 值。IE8 只有规定了 !DOCTYPE 才支持 "inherit"。IE9 支持 "inherit"。
The CSS background-color property is the foundation of changing background colors in HTML. This property tells the web browser what color to fill the background of an element, which can be anything from the entire webpage to a specific section, paragraph, button, or any other HTML tag. C...
一、语法不同 1、bgcolor:语法为bgColor="背景颜色"。2、background-color:语法为style="background-color:背景颜色"。二、作用不同 1、bgcolor:规定页面的背景颜色。2、background-color:设置元素的背景颜色。三、特点不同 1、bgcolor:bgcolor属性标志HTML文档的背景颜色,在 HTML 4.01 中,不赞...
backgroundColor 属性设置元素的背景颜色。 语法: Object.style.backgroundColor=color-name|color-rgb |color-hex|transparent 实例 本例设置 body 的背景色: <html> <head> <style type="text/css"> body { background-color:#B8BFD8; } </style> <script type="text/javascript"> function changeStyle(...
html5中background html5中background-repeat 背景 1. 背景 background-color设置背景颜色 background-image设置背景图片 如果背景图片大小小于元素,则背景图片会自动在元素中平铺将元素铺满 如果背景图片大小大于元素,则背景图片一部分会无法完全显示 如果背景图片大小等于元素,则背景图片会直接正常显示...
background:@color url(http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg) ; 示例如下: @color: #000000; body{// //先指定背景图片,在指定背景颜色 // background:url(http://beijing.gongjuji.net/imgdata/big/d55ae832-f677-44b8-9419-890f77b849a2.jpg...
In HTML and CSS, background color refers to the color applied to the background of a web page or to a specific HTML element. It is set with the background-color CSS property. By assigning this property a value (color), I can change the background color of ...
backgroundColor 属性设置元素的背景颜色。 语法: Object.style.backgroundColor=color-name|color-rgb |color-hex|transparent实例 本例设置 body 的背景色: <html> <head> <style type="text/css"> body { background-color:#B8BFD8; } </style> <script type="text/javascript"> function changeStyle()...
background-color:#cccccc; 但是你可以再使用background设置其背景颜色,覆盖前面的设置,如: background:#cccccc; 渐变背景 与图片背景设置方法一样,假如先设置了background为一个渐变背景,其CSS代码为: background:linear-gradient(90deg,#b828d1, transparent) #0085ff; ...
We earn a referral fee for some of the services we recommend on this page. Learn more Attribute of HTML Body Tag: Master The Most Important HTML Element Now What does HTML Body Background: Here Are The CSS Properties To Replace It With do? Was used to set the background color and ...