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 文字环绕效果 #9

Open
gaoryrt opened this issue Apr 25, 2019 · 3 comments
Open

css 文字环绕效果 #9

gaoryrt opened this issue Apr 25, 2019 · 3 comments
Labels
effect construct of some effect

Comments

@gaoryrt
Copy link
Member

gaoryrt commented Apr 25, 2019

实现效果如图,文字沿着圆形的边缘环绕

@gaoryrt gaoryrt changed the title css css 圆形文字环绕效果 Apr 25, 2019
@gaoryrt gaoryrt changed the title css 圆形文字环绕效果 css 文字环绕效果 Apr 25, 2019
@gaoryrt
Copy link
Member Author

gaoryrt commented Apr 25, 2019

这个就是个 shape-outside属性,使用也很简单:

<body>
  <div class="shape"></div>
  <div class="text">Lorem ipsum ...</div>
</body>
.shape {
  shape-outside: circle(50%);
  width: 500px;
  height: 500px;
  float: left;
}

@gaoryrt
Copy link
Member Author

gaoryrt commented Apr 25, 2019

除了 circle 之外,还支持很多 css 函数:

shape-outside: circle()
shape-outside: ellipse()
shape-outside: inset(10px 10px 10px 10px)
shape-outside: polygon(10px 10px, 20px 20px, 30px 30px)

当然 url 也可以:

shape-outside: url(image.png)

从支持的 css 函数来说,有点像 clip-path

@gaoryrt
Copy link
Member Author

gaoryrt commented Apr 25, 2019

只是兼容性并不算高:

@gaoryrt gaoryrt added the effect construct of some effect label Apr 25, 2019
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