SVG圆角矩形内的输入文件元素 [英] Input file element inside SVG Rounded Rectangle

查看:120
本文介绍了SVG圆角矩形内的输入文件元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将输入文件元素保留在SVG中?

Is it possible to keep input file element inside SVG?

我尝试过类似的操作,但未显示文件元素:

I tried something like this, but it's not showing file element :

<svg width="50" height="10">
<rect x="5" y="2" rx="2" ry="2" width="50" height="10"style="fill:red;stroke:black;stroke-width:5;opacity:0.5">
<input type="file"name="upload">
</svg>

有什么主意吗?

推荐答案

您想要的是svg foreignObject 元素:

What you want is the svg foreignObject element :

<svg width="80" height="40">
<rect x="5" y="2" rx="2" ry="2" width="70" height="30"style="fill:red;stroke:black;stroke-width:5;opacity:0.5"/>
<foreignObject width="70" height="30" x="7" y="3"><input type="file"name="upload"></foreignObject>
</svg>

这篇关于SVG圆角矩形内的输入文件元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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