博主信息
博文 31
粉丝 2
评论 0
访问量 35213
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
背景常用属性的使用方法
霏梦
原创
946人浏览过

- 作者:霏梦

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>背景各个属性的展示</title>
  7. <style>
  8. .box {
  9. width: 400px;
  10. height: 400px;
  11. /* border: 1px solid red; */
  12. /* border-radius: 15px; */
  13. border-radius: 200px;
  14. /* 背景色 */
  15. background-color: aquamarine;
  16. /* padding: 20px; */
  17. /* 背景裁切 */
  18. background-clip: content-box;
  19. /* background: red; */
  20. /* 渐变化 */
  21. background: linear-gradient(red, yellow);
  22. background: linear-gradient(45deg, red, yellow);
  23. background: linear-gradient(to right, red, yellow);
  24. background: linear-gradient(to left, red, yellow);
  25. background: linear-gradient(to left, red, white, yellow, blue);
  26. background: linear-gradient(
  27. to left,
  28. rgba(255, 0, 0, 0.5),
  29. white,
  30. yellow,
  31. blue
  32. );
  33. background-clip: content-box;
  34. /* 背景图片 */
  35. /* background-image: url("girl.jpg"); */
  36. /* 不重复显示 */
  37. background-repeat: no-repeat;
  38. /* background-repeat: repeat-x; */
  39. /* 固定 */
  40. /* background-attachment: fixed; */
  41. /* 背景定位 */
  42. /* 水平方向和垂直方向 */
  43. /* background-position: 50px 0; */
  44. /* background-position: 50px 50px; */
  45. background-position: right center;
  46. background-position: center right;
  47. /* 只写一个,第二个就是默认center*/
  48. /* background-position: left; */
  49. /* 水平是50% */
  50. background-position: 50% 50%;
  51. background-size: contain;
  52. background-size: cover;
  53. /* 简写 */
  54. background: violet;
  55. /* background: url("girl.jpg") no-repeat right; */
  56. background: url("girl.jpg") no-repeat center;
  57. position: relative;
  58. top: 30px;
  59. left: 30px;
  60. /* 阴影 */
  61. /* box-shadow: 5px 10px 10px #888888; */
  62. /* 外发光 */
  63. /* box-shadow: 0 0 10px #888888; */
  64. }
  65. .box:hover {
  66. /* 外发光 */
  67. box-shadow: 0 0 10px #888888;
  68. cursor: pointer;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <div class="box"></div>
  74. </body>
  75. </html>

girl

批改老师:WJWJ

批改状态:合格

老师批语:总的来说写的不错!
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学