分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

css3 border-radius

发布时间:2023-09-06 01:56责任编辑:赖小花关键词:暂无标签
  1. <!DOCTYPEhtml>
  2. <htmllang="en">
  3. <head>
  4. <metacharset="UTF-8">
  5. <title>CSS3边框</title>
  6. <style>
  7. body, ul, li, dl, dt, dd, h1, h2, h3, h4, h5 {
  8. margin: 0;
  9. padding: 0;
  10. }
  11. body {
  12. background-color: #F7F7F7;
  13. }
  14. .wrapper {
  15. width: 1000px;
  16. margin: 0 auto;
  17. padding: 20px;
  18. box-sizing: border-box;
  19. }
  20. header {
  21. padding: 20px 0;
  22. text-align: center;
  23. }
  24. headerh3 {
  25. line-height: 1;
  26. font-weight: normal;
  27. }
  28. .main {
  29. /*overflow: hidden;*/
  30. }
  31. .main:after {
  32. content: ‘‘;
  33. clear: both;
  34. display: block;
  35. }
  36. .main .item {
  37. width: 210px;
  38. height: 210px;
  39. margin: 0 30px 30px 0;
  40. display: flex;
  41. position: relative;
  42. background-color: #FFF;
  43. float: left;
  44. box-shadow: 2px 2px 5px #CCC;
  45. }
  46. .main .item:after {
  47. content: attr(data-brief);
  48. display: block;
  49. width: 100%;
  50. height: 100%;
  51. text-align: center;
  52. line-height: 210px;
  53. position: absolute;
  54. top: 0;
  55. left: 0;
  56. color: #FFF;
  57. font-family: ‘微软雅黑‘;
  58. background-color: rgba(170, 170, 170, 0);
  59. z-index: -1;
  60. transition: all 0.3s ease-in;
  61. }
  62. .main .item:hover:after {
  63. background-color: rgba(170, 170, 170, 0.6);
  64. z-index: 100;
  65. }
  66. .main .item:nth-child(4n) {
  67. margin-right: 0;
  68. }
  69. /*.main .item:nth-last-child(-n+5) {
  70. }*/
  71. /* 以上是骨架样式 */
  72. /* 1、2、3、4 顺时针 */
  73. .border-radius {
  74. width: 180px;
  75. height: 180px;
  76. margin: auto;
  77. border: 1px solid red;
  78. /*border-radius: 50% 30% 20%;*/
  79. }
  80. .square {
  81. border-radius: 0;
  82. }
  83. /*拱形*/
  84. .item:nth-child(1) .border-radius {
  85. border-radius: 90px;
  86. }
  87. /*拱形*/
  88. .item:nth-child(2) .border-radius {
  89. border-radius: 90px 90px 0 0;
  90. }
  91. /*半圆*/
  92. .item:nth-child(3) .border-radius {
  93. height: 90px;
  94. border-radius: 90px 90px 0 0;
  95. }
  96. /*左上角*/
  97. .item:nth-child(4) .border-radius {
  98. /*height: 90px;*/
  99. border-radius: 90px 0 0 0;
  100. }
  101. /*四分之一圆*/
  102. .item:nth-child(5) .border-radius {
  103. width: 90px;
  104. height: 90px;
  105. border-radius: 90px 0 0 0;
  106. }
  107. /*横着的椭圆*/
  108. .item:nth-child(6) .border-radius {
  109. height: 90px;
  110. /*border-radius: 50%;*/
  111. border-radius: 90px 90px 90px 90px / 45px 45px 45px 45px;
  112. /*border-radius: 45px / 90px;*/
  113. }
  114. /*竖着的椭圆*/
  115. .item:nth-child(7) .border-radius {
  116. width: 90px;
  117. border-radius: 45px 45px 45px 45px / 90px 90px 90px 90px;
  118. }
  119. /*半个横着的椭圆*/
  120. .item:nth-child(8) .border-radius {
  121. height: 45px;
  122. border-radius: 90px 90px 0 0 / 45px 45px 0 0;
  123. }
  124. /*半个竖着的椭圆*/
  125. .item:nth-child(9) .border-radius {
  126. width: 45px;
  127. border-radius: 45px 0 0 45px / 90px 0 0 90px;
  128. }
  129. /*四分之一竖着的椭圆*/
  130. .item:nth-child(10) .border-radius {
  131. width: 45px;
  132. height: 90px;
  133. border-radius: 45px 0 0 0 / 90px 0 0 0;
  134. }
  135. /*饼环*/
  136. .item:nth-child(11) .border-radius {
  137. width: 40px;
  138. height: 40px;
  139. border: 70px solid red;
  140. border-radius: 90px;
  141. }
  142. /*圆饼*/
  143. .item:nth-child(12) .border-radius {
  144. width: 40px;
  145. height: 40px;
  146. border: 70px solid red;
  147. border-radius: 60px;
  148. }
  149. /*左上角圆饼*/
  150. .item:nth-child(13) .border-radius {
  151. width: 60px;
  152. height: 60px;
  153. border: 60px solid red;
  154. border-radius: 90px 0 0 0;
  155. }
  156. /*对角圆饼*/
  157. .item:nth-child(14) .border-radius {
  158. width: 60px;
  159. height: 60px;
  160. border: 60px solid red;
  161. border-radius: 90px 0 90px 0;
  162. }
  163. /*四边不同色*/
  164. .item:nth-child(15) .border-radius {
  165. width: 0px;
  166. height: 0px;
  167. border-width: 90px;
  168. border-style: solid;
  169. border-color: red green yellow blue;
  170. }
  171. /*右透明色*/
  172. .item:nth-child(16) .border-radius {
  173. width: 0px;
  174. height: 0px;
  175. border-width: 90px;
  176. border-style: solid;
  177. border-color: red green yellow blue;
  178. border-right-color: transparent;
  179. }
  180. /*圆右透明色*/
  181. .item:nth-child(17) .border-radius {
  182. width: 0px;
  183. height: 0px;
  184. border-width: 90px;
  185. border-style: solid;
  186. border-color: red;
  187. border-right-color: transparent;
  188. border-radius: 90px;
  189. }
  190. /*圆右红透明色*/
  191. .item:nth-child(18) .border-radius {
  192. width: 0px;
  193. height: 0px;
  194. border-width: 90px;
  195. border-style: solid;
  196. border-color: transparent;
  197. border-right-color: red;
  198. border-radius: 90px;
  199. }
  200. /*阴阳图前世*/
  201. .item:nth-child(19) .border-radius {
  202. width: 180px;
  203. height: 0px;
  204. border-top-width: 90px;
  205. border-bottom-width: 90px;
  206. border-style: solid;
  207. border-top-color: red;
  208. border-bottom-color: green;
  209. /*border-right-color: red;*/
  210. border-radius: 90px;
  211. }
  212. /*阴阳图前世2*/
  213. .item:nth-child(20) .border-radius {
  214. width: 180px;
  215. height: 90px;
  216. border-bottom-width: 90px;
  217. border-style: solid;
  218. border-bottom-color: green;
  219. background-color: red;
  220. /*border-right-color: red;*/
  221. border-radius: 90px;
  222. }
  223. /*阴阳图今生*/
  224. .item:nth-child(21) .border-radius {
  225. width: 180px;
  226. height: 90px;
  227. border-bottom-width: 90px;
  228. border-style: solid;
  229. border-bottom-color: green;
  230. background-color: red;
  231. border-radius: 90px;
  232. position: relative;
  233. }
  234. .item:nth-child(21) .border-radius::after,
  235. .item:nth-child(21) .border-radius::before {
  236. content: ‘‘;
  237. position: absolute;
  238. top: 50%;
  239. width: 20px;
  240. height: 20px;
  241. /*margin: -10px 0 0 0;*/
  242. border-width: 35px;
  243. border-style: solid;
  244. /*border-radius: 45px;*/
  245. }
  246. /*左阴阳*/
  247. .item:nth-child(21) .border-radius::after {
  248. background-color: red;
  249. border-color: green;
  250. }
  251. /*右阴阳*/
  252. .item:nth-child(21) .border-radius::before {
  253. background-color: green;
  254. border-color: red;
  255. right: 0;
  256. }
  257. </style>
  258. </head>
  259. <body>
  260. <div>
  261. <header>
  262. <h3>CSS3边框圆角</h3>
  263. </header>
  264. <div>
  265. <div data-brief="整圆">
  266. <div></div>
  267. </div>
  268. <div data-brief="拱形">
  269. <div></div>
  270. </div>
  271. <div data-brief="半圆">
  272. <div></div>
  273. </div>
  274. <div data-brief="左上角">
  275. &
我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved