资讯专栏INFORMATION COLUMN

【代码笔记】Web-CSS-CSS background背景

番茄西红柿 / 693人阅读

摘要:实例改文本插入在元素中该段落有自己的背景颜色背景图片不重复,设置实例背景图片只显示一次,并与文本分开实例中还添加了属性用于让图片与文本间隔开参考资料菜鸟教程

一,效果图。

二,代码。

</>复制代码

  1. DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CSS backgroundstitle>
  6. <style>
  7. h1 {
  8. background-color: #6495ed;
  9. }
  10. p {
  11. background-color: #e0ffff;
  12. }
  13. div {
  14. background-color: #b0c4de;
  15. }
  16. body {
  17. background-image: url(paper.gif);
  18. background-color: #cccccc;
  19. background-repeat: no-repeat;
  20. background-position: right top;
  21. margin-right: 200px;
  22. }
  23. body {
  24. background: #ffffff url("img_tree.png") no-repeat right top;
  25. margin-right: 200px;
  26. }
  27. style>
  28. head>
  29. <body>
  30. <h1>CSS background-color实例!h1>
  31. <div>改文本插入在div元素中.div>
  32. <p>该段落有自己的背景颜色p>
  33. <p>背景图片不重复,设置position实例p>
  34. <p>背景图片只显示一次,并与文本分开p>
  35. <p>实例中还添加了margin-right属性用于让图片与文本间隔开p>
  36. body>
  37. html>

参考资料:《菜鸟教程》

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/1325.html

相关文章

发表评论

0条评论

最新活动
阅读需要支付1元查看
<