CSS wrong appearance of border-radius on a nested div

后端 未结 6 1659
南方客
南方客 2020-12-01 22:39

Using the following HTML I need to:

  • Make sure that the border of target div (pink) is adjacent of the wrapper-target red border di

6条回答
  •  执笔经年
    2020-12-01 23:13

    Maby this wil help. The css is now set in a external file.

    The border-radius:inherit; checks the border-radius that is already there. so it sets to that border-radius.

    *,
    *:after,
    *:before {
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
    }
    #wrapper-target {
      position: absolute;
      top: 100px;
      left: 100px;
      width: 250px;
      height: 250px;
      border-radius: 50px;
      border: 25px solid red;
      background-color: plum;
    }
    #target {
      position: relative;
      width: 100%;
      height: 100%;
      background-color: plum;
      border-radius: inherit;
    }

提交回复
热议问题