博客列表 >背景常用属性的使用方法

背景常用属性的使用方法

霏梦
霏梦原创
2020年06月20日 08:46:56753浏览

- 作者:霏梦

  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

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议