【每日一学】用CSS3绘制一个红星。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } body{ background-color: plum; } .heart{ width: 200px; height: 300px; margin: 100px auto; /*border: 1px solid #000;*/ position: relative; } /*利用伪元素 伪造两个盒子*/ .heart::before,.heart::after{ content: "YOU"; position: absolute; height: 100%; width: 100%; background-color: red; border-radius: 100px 100px 0 0; transform: rotate(-45deg); line-height: 150px; text-align: center; color: yellow; font-size: 24px; } .heart::after{ content: "ME"; position: absolute; left: 72px; transform: rotate(45deg); } </style> </head> <body> <div></div> </body> </html
网友评论文明上网理性发言 已有0人参与
发表评论: