MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
您的搜索结果

    background-color

    摘要

    background-color sets the background color of an element, either through a color value or the keyword transparent.

    • 初始值: transparent
    • 应用于: all elements
    • 继承性: no
    • 百分比: N/A
    • 媒体: visual
    • Computed value: as specified

    语法

    background-color:color | transparent | inherit
    

    color 
    The color can be specified as a hexidecimal RGB value, a regular RGB value, or by using one of the pre-defined color keywords.
    transparent 
    The default value for background-color is transparent meaning the element has no color of its own, instead showing the color of the element behind it.

    例子

    查看在线演示

    .exampleone {
    	background-color: teal;
    	color: white;
    }
    
    .exampletwo {
    	background-color: rgb(153,102,153);
    	color: rgb(255,255,204);
    }
    
    .examplethree {
    	background-color: #666699;
    	color: #FFFFFF;
    }
    
    

    提示

    (Add links to good colour reference sites here.)

    规范

    兼容性

    TBD: This may be removed in favour of a centralized compatibility chart.

    参见

    Background-related CSS properties: background, background-attachment, background-clip, background-color, background-image, background-origin, background-position, background-repeat, background-size

     

    文档标签和贡献者

    标签: 
    此页面的贡献者有: Mickeyboy, teoli
    最后编辑者: teoli,