--- title: CSS Backgrounds and Borders slug: Web/CSS/CSS_Backgrounds_and_Borders tags: - CSS - CSS Backgrounds and Borders - NeedsTranslation - Overview - Reference translation_of: Web/CSS/CSS_Backgrounds_and_Borders ---
{{CSSRef}}

CSS Backgrounds and Borders 是CSS的一个模块,它可以让你为元素的背景和边框设置样式。背景可以用颜色或图像填充,剪裁或调整大小,以及以其他方式修改。边框可以用线条或图像装饰,并制成方形或圆形。此外,元素框可以用阴影装饰。

Reference

CSS 属性

指南

工具

Using multiple backgrounds
Explains how to set one or more backgrounds on an element.
Scaling background images
Describes how to change the size and repeating behavior of background images.
Applying color to HTML elements using CSS
An overview of how CSS color can be used in HTML, including for borders.
Border-image 生成器
此交互式工具让你以可视化方式创建边框图像({{cssxref("border-image")}} 属性)。
Border-radius 生成器
此交互式工具让你以可视化方式创建圆角({{cssxref("border-radius")}} 属性)。
Box-shadow 生成器
此交互式工具让你以可视化方式创建元素身后的阴影({{cssxref("box-shadow")}} 属性)。

规范

规范 状态 备注
{{ SpecName('CSS3 Backgrounds') }} {{ Spec2('CSS3 Backgrounds') }}  
{{SpecName('CSS2.1', 'box.html')}} {{Spec2('CSS2.1')}}  
{{SpecName('CSS1', '#border')}} {{Spec2('CSS1')}}  

浏览器兼容性

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{CompatGeckoDesktop("1.0")}} 4.0 3.5 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.9.2")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} 1.0