-
Notifications
You must be signed in to change notification settings - Fork 5k
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 Shapes 简介 #4957
CSS Shapes 简介 #4957
Conversation
校对认领 |
@ElizurHz 好的呢 🍺 |
|
||
CSS Shapes allow us to define geometric shapes that text can flow around. These shapes can be circles, ellipses, simple or complex polygons, and even images and gradients. A few practical design applications of Shapes might be displaying circular text around a circular avatar, displaying text over the simple part of a full-width background image, and displaying text flowing around drop caps in an article. | ||
CSS Shaptes 允许我们定义文本环绕的几何形状。这些形状可以是圆、椭圆、简单或复杂的多边形,甚至图像和渐变。Shapes 的一些实际设计应用可能是圆形头像周围显示圆形环绕文本,全屏背景图片的简单部位上面展示文本,以及在文章中显示首字下沉。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shaptes => Shapes
|
||
The current implementation of CSS Shapes is [CSS Shapes Module Level 1](https://drafts.csswg.org/css-shapes/), which mostly revolves around the `[shape-outside](https://tympanus.net/codrops/css_reference/shape-outside/)` property. `shape-outside` defines a shape that text can flow around. | ||
CSS Shapes 的当前实现是 [CSS Shapes 模块 1 级](https://drafts.csswg.org/css-shapes/),它主要包含 `[shape-outside](https://tympanus.net/codrops/css_reference/shape-outside/)` 属性。`shape-outside` 定义了文本环绕的形状。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSS Shapes Module Level 1 建议保留英文原文,翻译出来感觉略怪
|
||
Considering there is a `shape-outside` property, you might assume there is a corresponding `shape-inside` property that would contain text within a shape. A `shape-inside` property might become a reality in the future, but it is currently a draft in [CSS Shapes Module Level 2](https://drafts.csswg.org/css-shapes-2/), and is not implemented by any browser. | ||
考虑到有 `shape-outside` 属性,你可能会想到还有一个相应的 `shape-inside` 属性,它包含形状内的文本。`shape-inside` 属性可能会在将来实现,目前它只是 [CSS Shapes 模块 2 级](https://drafts.csswg.org/css-shapes-2/)里面的一个草案,并没有被任何浏览器实现。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSS Shapes Module Level 2 建议保留英文原文,翻译出来感觉略怪
The `circle()` function takes an optional parameter of radius. In our case, the default radius (_r_) is `50%`, or `100px`. Using `circle(50%)` or `circle(100px)` would produce the same result as what we’ve already done. | ||
You might notice the text is right up against the shape. We can use the [`shape-margin`](https://tympanus.net/codrops/css_reference/shape-margin/) property to add a margin to the shape, which can be set in `px`, `em`, `%`, and any other standard CSS unit of measurement. | ||
`circle()` 函数接收可选的 radius 参数。在本例中,默认 radius 是 `50%` 或者 `100px`。使用 `circle(50%)` 或者 `circle(100px)` 都将产生和我们已经完成样例的同样结果。 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多了一个空行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原文是两个段落,这里需换行,不然会合成一段
|
||
 | ||
|
||
The difference between an `ellipse()` and a `circle()` is that an ellipse has two radii – _r_x and _r_y, or the X-axis radius and Y-axis radius. Therefore, the above example can also be written as: | ||
`ellipse()` 和 `circle()` 的区别在于椭圆有两个 radii —— _r_x 和 _r_y,或者 X-axis radius 和 Y-axis radius。因此,上面的例子也可以写成: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
radii: radius 的复数
ellipse()
和 circle()
的区别在于椭圆有两个 radii —— _r_x 和 _r_y,或者 X-axis radius 和 Y-axis radius。 =>
ellipse()和
circle()` 的区别在于椭圆有两个半径 —— _r_x 和 _r_y,或者 X 轴半径和 Y 轴半径。
|
||
``` | ||
ellipse(75px 150px); | ||
``` | ||
|
||
The position parameters are the same for circles and ellipses. The radii, in addition to being a unit of measurement, also include the options of `farthest-side` and `closest-side`. | ||
circles 和 ellipses 的位置参数是一样的。除了是测量单位,radii 也包括 `farthest-side` 和 `closest-side` 的选项。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
radii: radius 的复数
@leviding 校对认领 |
@Moonliujk 妥妥哒 🍻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
翻译的不错,一些小的错误指出希望译者注意一下。
You might notice the text is right up against the shape. We can use the [`shape-margin`](https://tympanus.net/codrops/css_reference/shape-margin/) property to add a margin to the shape, which can be set in `px`, `em`, `%`, and any other standard CSS unit of measurement. | ||
`circle()` 函数接收可选的 radius 参数。在本例中,默认 radius 是 `50%` 或者 `100px`。使用 `circle(50%)` 或者 `circle(100px)` 都将产生和我们已经完成样例的同样结果。 | ||
|
||
你可能注意到文本刚好和形状贴合。我们可以使用 [`shape-margin`](https://tympanus.net/codrops/css_reference/shape-margin/) 属性给形状添加 margin,单位可以是 `px`、`em`、`%` 和其他标准的CSS测量单位。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSS 前后需要添加空格
|
||
Now that CSS Shapes have gained widespread support across modern browsers, it’s worth taking a look into the flexibility and functionality they provide to see if they might make sense in your next design project. | ||
现在 CSS Shapes 已经获得了现代浏览器的广泛支持,值得一看的是它们提供的灵活性和功能,以确定它们在您的下一个设计项目中是否有意义。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以确定它们在您的下一个设计项目中是否有意义。
=》
以确定它们在你的下一个设计项目中是否有意义。
与后文翻译统一一下,都翻译 你 比较好
@@ -184,9 +185,9 @@ ellipse(farthest-side closest-side at 25% 25%) | |||
|
|||
 | |||
|
|||
### Inset | |||
### 插入 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
插入
=》
内嵌
前后译文保持统一
@@ -337,15 +338,15 @@ Unlike in the other examples, we’re going to use an `img` tag instead of a `di | |||
|
|||
 | |||
|
|||
Since the image I used was a star with a transparent background, the text knew which areas were transparent and which were opaque, and aligned itself accordingly. | |||
因为我使用了透明背景的星星图像,文本知道哪些区域是透明的哪些是不透明的,并相应地调整自己。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
并相应地调整自己
=》
并进行自适应地布局。
稍微调整了一下,仅供参考
@@ -365,13 +366,13 @@ I’m going to make a gradient example that’s a 50%/50% split of a color and t | |||
|
|||
 | |||
|
|||
We can see the gradient is perfectly split diagonally at the center of opaque and transparent. | |||
我们可以看到渐变在不透明和透明的中心对角线完美分割 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
末尾需要添加句号
@xilihuasi @leviding 校对完成 |
@xilihuasi 可以修改啦~ |
@leviding 根据校对者意见修改完成 |
@xilihuasi 已经 merge 啦~ 快快麻溜发布到掘金然后给我发下链接,方便及时添加积分哟。 掘金翻译计划有自己的知乎专栏,你也可以投稿哈,推荐使用一个好用的插件。 |
译文翻译完成,resolve #4911