网站建设资讯

NEWS

网站建设资讯

css如何设置背景

在CSS中,可以使用以下几种方法设置背景:

成都创新互联公司主营松原网站建设的网络公司,主营网站建设方案,重庆App定制开发,松原h5微信小程序开发搭建,松原网站营销推广欢迎松原等地区企业咨询

1、背景颜色

语法:backgroundcolor: color;

示例:backgroundcolor: #FF0000;

2、背景图片

语法:backgroundimage: url(image_url);

示例:backgroundimage: url(‘image.jpg’);

3、背景重复

语法:backgroundrepeat: value;

示例:backgroundrepeat: norepeat;

4、背景定位

语法:backgroundposition: position;

示例:backgroundposition: center top;

5、背景大小

语法:backgroundsize: size;

示例:backgroundsize: cover;

6、背景附件

语法:backgroundattachment: attachment;

示例:backgroundattachment: fixed;

7、背景简写属性

语法:background: color image repeat position/size attachment;

示例:background: #FF0000 url(‘image.jpg’) norepeat center top/cover fixed;

下面是一个使用小标题和单元表格的示例:

CSS背景设置

CSS属性语法示例
背景颜色backgroundcolor: color;backgroundcolor: #FF0000;
背景图片backgroundimage: url(image_url);backgroundimage: url(‘image.jpg’);
背景重复backgroundrepeat: value;backgroundrepeat: norepeat;
背景定位backgroundposition: position;backgroundposition: center top;
背景大小backgroundsize: size;backgroundsize: cover;
背景附件backgroundattachment: attachment;backgroundattachment: fixed;
背景简写属性background: color image repeat position/size attachment;background: #FF0000 url(‘image.jpg’) norepeat center top/cover fixed;

文章题目:css如何设置背景
文章分享:http://cdysf.com/article/dhddjjs.html