从CSS样式化边框图像svg(颜色)? [英] Style border-image svg (colors) from CSS?

查看:280
本文介绍了从CSS样式化边框图像svg(颜色)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从CSS样式填充自定义边框图像? 我应该使用哪个属性?

Is it possible to style fill custom border-image from the css? Which property should I use?

例如

border-image-source:url('assets/images/dots_new.svg');
border-color: red; /* doesn’t work */
fill: red; /* doesn’t work */

推荐答案

否.这不可能. SVG是一个外部文件,无法通过页面中的CSS设置样式.

No. It is not possible. The SVG is an external file and cannot be styled from the CSS in your page.

最好的办法是将样式添加为SVG中的<style>块.但是,当然,这意味着每种颜色组合必须有一个SVG文件.

The best you can do is add the styling as a <style> block in your SVG. But of course, that means that you have to have one SVG file per colour combination.

这篇关于从CSS样式化边框图像svg(颜色)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆