zoukankan      html  css  js  c++  java
  • h5-伪元素-before和after

    做一个门票或者邮票:效果图

    1.html就是两个div

    2.具体css代码

     1     <style>
     2         /*左侧长方体基本样式*/
     3         div:nth-of-type(1){
     4             width: 300px;
     5             height: 200px;
     6             background-color: red;
     7             float: left;
     8         }
     9         /*右侧长方体基本样式*/
    10         div:nth-of-type(2){
    11             width: 100px;
    12             height: 200px;
    13             background-color: blue;
    14             float: left;
    15             position: relative;
    16         }
    17         /*第一个伪元素:before是遮盖上边缘的圆形,当然也可以是别的形状*/
    18         div:nth-of-type(2)::before{
    19             /*必须添加content属性,否则后期看不到*/
    20             content: "";
    21             /*默认是行级元素,如果想设置宽高,必须转换成块级元素*/
    22             position: absolute;
    23             width: 20px;
    24             height: 20px;
    25             background-color: #fff;
    26             border-radius: 10px;
    27             left: -10px;
    28             top: -10px;
    29         }
    30         /*第一个伪元素:after是遮盖下边缘的圆形,同上也可以是别的形状*/
    31         div:nth-of-type(2)::after{
    32             /*必须添加content属性,否则后期看不到*/
    33             content: "";
    34             /*默认是行级元素,如果想设置宽高,必须转换成块级元素*/
    35             position: absolute;
    36             width: 20px;
    37             height: 20px;
    38             background-color: #fff;
    39             border-radius: 10px;
    40             left: -10px;
    41             bottom: -10px;
    42         }
    43     </style>
  • 相关阅读:
    软件概要设计说明书(初稿) 定稿
    重新确定了数据流图以及模块图2020.5.4
    开始编写概要说明书以及详细说明书2020.4.29
    singleflight是如何避免缓存击穿的?
    从IO 到BIO/NIO/AIO 浅析
    JVM
    Http
    Linux命令
    什么时候触发MinorGC?什么时候触发FullGC?
    计算机网络
  • 原文地址:https://www.cnblogs.com/FengBrother/p/11373093.html
Copyright © 2011-2022 走看看