好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CSS:背景颜色/背景图像_html/css_WEB-ITnose

使用CSS可以为html标签指定背景图像或背景颜色,并且可以设置图像的位置。

代码整理自w3school:http://www.w3school.com.cn

             h1 {background-color:#afa}    h2 {background-color:rgb(255,187,187)}    div#bgImage       {      background-image:url(images/bg_image.jpg);      padding:10px;      }    div#bgImageKeywords      {      background-color:#ddd;      background-image:url(images/d_sikao.png);      padding:30px;      background-repeat:no-repeat;      background-position:left bottom;      }      div#bgImagePercent      {      width:400px;      background-color:#ddd;      background-image:url(images/d_sikao.png);      padding:40px;      background-repeat:no-repeat;      background-position:20% 80%;      }      div#bgImageOffset      {      width:400px;      background-color:#ddd;      background-image:url(images/d_sikao.png);      padding:40px;      background-repeat:no-repeat;      background-position:200px 20px;      }      div#bgImageAttach      {      background-image:url(images/bg_image.jpg);      padding:10px;      background-attachment:fixed;      }     CSS 背景    

这是一个h1级别的标题:淡绿色

这是一个h2级别的标题:淡红色

这是一个h3级别的标题(没有设定样式)

这个段落有背景图像,有内边距,允许重复(默认)

查看更多关于CSS:背景颜色/背景图像_html/css_WEB-ITnose的详细内容...

  阅读:35次