Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Css 如何画出一个扇形,动手实现下 #228

Open
lgwebdream opened this issue Jul 6, 2020 · 4 comments
Open

Css 如何画出一个扇形,动手实现下 #228

lgwebdream opened this issue Jul 6, 2020 · 4 comments
Labels
Css teach_tag 头条 company 编程题 teach_tag

Comments

@lgwebdream
Copy link
Owner

No description provided.

@lgwebdream lgwebdream added Css teach_tag 头条 company 编程题 teach_tag labels Jul 6, 2020
@lgwebdream
Copy link
Owner Author

扫描下方二维码,获取答案以及详细解析,同时可解锁800+道前端面试题。

@tanxu1a
Copy link

tanxu1a commented Jul 8, 2020

<div class="sector"></div>

.sector{
      width: 200px;
      height: 200px;
      border-radius: 200px;
      background-color: deepskyblue;
      position: relative;
    }
    .sector::before{
      content: "";
      width: 200px;
      height: 200px;
      position: absolute;
      background-color: white;
      border-radius: 200px;
      /*裁减半圆,再做旋转*/
      clip: rect(0px,100px,200px,0);
      transform: rotate(-60deg);
    }
    .sector::after{
      content: "";
      width: 200px;
      height: 200px;
      position: absolute;
      background-color: white;
      border-radius: 200px;
      /*裁减半圆,再做旋转*/
      clip: rect(0px,200px,200px,100px);
      transform: rotate(60deg);
    }

@shenzhongkang
Copy link

90deg sector : )

<>
  <style>
    #demo {
      position: relative;
      width: 50px;
      height: 50px;
      overflow: hidden;
    }
    #circle {
      position: absolute;
      width: 100px;
      height: 100px;
      background-color: black;
      border-radius: 50%;
    }
  </style>
  <body>
    <div id="demo">
      <div id="circle"></div>
    </div>
  </body>
</>

@GolderBrother
Copy link

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Css画出一个扇形</title>
    <style>
        #sector {
            width: 0;
            height: 0;
            border: 100px solid;
            border-radius: 100px;
            border-color: orangered transparent transparent transparent;
        }
    </style>
</head>
<body>
    <div id="sector"></div>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Css teach_tag 头条 company 编程题 teach_tag
Projects
None yet
Development

No branches or pull requests

4 participants