【发布时间】:2016-06-05 11:29:33
【问题描述】:
我目前正在使用
在 web 视图中显示 HTML 内容WebView.NavigateToString("<html><body>" + Content.content + "</body></html>");
这会按预期生成内容,但目前没有样式。我将如何为列表和段落等 HTML 元素添加样式。
谢谢
【问题讨论】:
我目前正在使用
在 web 视图中显示 HTML 内容WebView.NavigateToString("<html><body>" + Content.content + "</body></html>");
这会按预期生成内容,但目前没有样式。我将如何为列表和段落等 HTML 元素添加样式。
谢谢
【问题讨论】:
为了给您的内容一些样式,您需要为其提供适当的 css 文件。
您可以在添加 css 文件时使用“ms-appx-web”协议来做到这一点。
WebView.NavigateToString("<html>
<head>
<link rel=\"stylesheet\"
href=\"ms-appx-web:///Views/web/web.css\"
type=\"text/css\"
media=\"screen\" />
</head>
<body>" + Content.content + "</body></html>");
您可以查看描述如何操作的原始博客文章。 [Windows 8] Insert a local CSS/JS file in the HTML of a Webview
祝你好运。
【讨论】: