如何将SVG文件包含为< input>背景 [英] How to Include SVG file as <input> background

查看:1263
本文介绍了如何将SVG文件包含为< input>背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是SVG世界的新手,刚开始尝试今天。我正在尝试创建一个移动网站,其中主要图形都是可扩展的,因此支持所有显示分辨率。

I'm a newbie to the SVG world, just started experimenting today. I'm trying to create a mobile site where the primary graphics are all scalable, thus supporting all display resolutions.

我为我的输入创建了一个svg文件(当前type = 图像),令人惊讶的是结果与我的代码编辑器(Coda)中的结果一致。在测试(移动Safari,DT Safari和DT FF)时,输入显示损坏的图像路径占位符(誓言是正确的,因为我可以右键单击以下载文件)。

I created an svg file for my input (currently type="image"), and suprisingly the results are as expected in my code editor (Coda). In testing (mobile Safari, DT Safari and DT FF), the input displays broken image path placeholder (the oath is correct because I can right-click to download the file).

如何在(html5)文档中包含我的SVG文件?

How do I go about including my SVG file in the (html5) document?

推荐答案

参见在背景图像中使用SVG 。用于在输入中放置背景图像的CSS与任何其他元素相同:

See Using SVG in background-image. The CSS for placing a background image in an input is the same as for any other element:

input { background-image:url('foo.svg') }

这篇关于如何将SVG文件包含为< input>背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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