【问题标题】:How can i insert an image inside html code?如何在 html 代码中插入图像?
【发布时间】:2011-09-02 12:19:49
【问题描述】:

我需要将背景图像添加到包含在我加载到 UIWebView 中的 HTML 代码中的电话号码

NSString *stringToReplace = [NSString stringWithFormat:@"<a style=\"color:white; background-color:#707070; text-decoration:none\" href=\"compose://%@\">%@</a>",substring,substring];
    newString = [newString stringByReplacingOccurrencesOfString:substring withString:stringToReplace];

我已设法更改背景颜色,但我需要将图像作为背景。 主要目标是在电话号码后面制作带有圆角的浅灰色背景。

我找到了问题所在 solution

谢谢,

【问题讨论】:

标签: iphone html css ios uiwebview


【解决方案1】:

我不太了解你的代码,也许你应该使用css background images

background: #afdafd    url('path...');
          /*def.color. back.img.*/  

<a style=\"color:white; background:#707070 url('/images/rounded-corner.png'); text-decoration:none\" href=\"compose://%@\">%@</a>

【讨论】:

  • 我尝试添加这样的图像,但无法加载。我应该为我的图像指定什么路径?
  • 我只看到灰色背景,没有图像
  • 指向图片的路径。尝试在浏览器中打开图像并使用地址栏中的路径。
  • 这是一个 iPhone 应用程序,我尝试放置路径,但没有显示图像。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-21
  • 2014-01-23
  • 1970-01-01
  • 2013-08-25
  • 2023-02-04
  • 1970-01-01
相关资源
最近更新 更多