请马上登录,朋友们都在花潮里等着你哦:)
您需要 登录 才可以下载或查看,没有账号?立即注册
x
下面在一行两列的 css-doodle 图案里,我们采用两种方法分别在两个单元格中通过 @svg 函数使用 svg 绘制单元格背景——两个一模一样的圆。这两种方法,第一种是 HTML 方法,第二种是 CSS 方法:
<css-doodle grid="2x1">
:doodle { @size: 400px 200px; gap: 1px; }
@nth(1) {
background: #ddd @svg(
<svg width="100%" height="100%">
<circle cx="100" cy="100" r="80" fill="none" stroke="red" />
</svg>
);
}
@nth(2) {
background: #eee @svg(
circle {
cx: 100;
cy: 100;
r: 80;
fill: none;
stroke: red;
}
);
}
</css-doodle>
所有的 svg 图案,基本都可以通过上述两种方法在 css-doodle 中使用。第一种方法更逼近原生 svg 但语句繁琐,第二种是封装成了 css-doodle 的 CSS 语句模式,直观但行数偏多。两种方法都能达到同样的目的。
|