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 yinyang 阴阳太极图 #12

Open
gaoryrt opened this issue Dec 3, 2019 · 8 comments
Open

css yinyang 阴阳太极图 #12

gaoryrt opened this issue Dec 3, 2019 · 8 comments
Labels
effect construct of some effect

Comments

@gaoryrt
Copy link
Member

gaoryrt commented Dec 3, 2019

<div class="yinyang"></div>
请填写yinyang的css

@gaoryrt gaoryrt changed the title css yingyang 阴阳太极图 css yinyang 阴阳太极图 Dec 3, 2019
@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

background-image: data:xxx
base64 background image

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

两个伪元素

    #yin-yang {
      width: 96px;
      box-sizing: content-box;
      height: 48px;
      background: #eee;
      border-color: red;
      border-style: solid;
      border-width: 2px 2px 50px 2px;
      border-radius: 100%;
      position: relative;
    }
    #yin-yang:before {
      content: "";
      position: absolute;
      top: 50%;
      left: 0;
      background: #eee;
      border: 18px solid red;
      border-radius: 100%;
      width: 12px;
      height: 12px;
      box-sizing: content-box;
    }
    #yin-yang:after {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      background: red;
      border: 18px solid #eee;
      border-radius: 100%;
      width: 12px;
      height: 12px;
      box-sizing: content-box;
    }

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

.yingyang:after {
    content: '☯'
}

utf-8 emoji

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

background-image:url('data:image/svg+xml;charset=UTF-8,<svg>...</svg>')
inline svg background image

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

  .yinyang {
      position: relative;
      height: 100px;
      width: 0;
      border-radius: 100px;
      border-left: black 50px solid;
      border-right: white 50px solid;
      filter: drop-shadow(0 0 1px black);
    }
    .yinyang:before,
    .yinyang:after {
      position: absolute;
      content: '';
      height: 20px;
      width: 20px;
      border-radius: 25px;
      border: 15px solid #000;
      background: #fff;
      z-index: 2;
      top: 0;
      left: -25px;

    }
    .yinyang:after {
      top: 50px;
      border: 15px solid #fff;
      background: #000;
    }

伪元素版2

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

.yinyang {
	width: 500px;
	height: 500px;
	border-radius: 50%;
	border: solid red 10px;
	backgrround:
		no-repeat 0 50%/50% 50% radial-gradient(#fff, #fff 50px, red 50%, red 125px, transparent 125px),
		no-repeat right 50%/50% 50% radial-gradient(red, red 50px, #fff 50px, #fff 125px, transparent 125px),
		no-repeat center/100% linear-gradient(#fff, #fff 50%, red 50%)
}

径向渐变 background 写一切

@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

css maskclip-path 应该都可以,但是都要用到 svg

@gaoryrt gaoryrt added the effect construct of some effect label Dec 3, 2019
@gaoryrt
Copy link
Member Author

gaoryrt commented Dec 3, 2019

iconfont 也是个办法,但是还是要先画图,然后生成字体再引用,有点麻烦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effect construct of some effect
Projects
None yet
Development

No branches or pull requests

1 participant