Telerik Mvc 图表控制字体样式
美好的一天,
这是我第一次使用 Telerik MVC 图表控件,我发现很难更改图表轴的默认字体。我尽可能多地在互联网上搜索,但无法找到解决方案。
我现在正在 IE 9 上进行测试。
我使用开发人员工具查看源代码和样式,我发现图表被分解为包含“svg”对象的 div 标签。在“svg”内部有图形 Y 轴上的项目的“文本”对象。单击任何“文本”项并在开发人员工具中选择“样式”,会显示一个名为“内联样式”的部分。字体样式在“内联样式”部分中指定,但我没有在项目中的任何 CSS 文件中指定它。
如何使用 CSS 类更改“svg”的那些“文本”条目的字体?
我必须指出,我没有指定任何主题。我的项目中包含的唯一 telerik 文件是“telerik.common.min.css”、“telerik.default.min.css”和包含 JS 文件的 Scripts 文件夹。
在图表上使用“.HtmlAttributes(new { style = "font-family: Verdana; etc..." })”来设置 font-family 或其他与字体相关的样式不起作用。
先感谢您。
Good day,
It's the first time I'm working with a Telerik MVC Chart control and I'm finding it difficult to change the chart's axes' default font. I searched the internet as much as I could but couldn't come up with a solution.
I'm testing on IE 9 at the moment.
I used Developer Tools to view the source and styles and what I picked up was that the chart is broken up into a div tag that contains an "svg" object. Inside the "svg" there are "text" objects for the items on the Y axis of the graph. Clicking on any "text" item and selecting "Style" in Developer Tools, reveals a section called "inline style". The font style is specified in the "inline style" section but I don't specify it in any of my CSS files in the project.
How can I change the font of those "text" entries of the "svg" by using a CSS class?
I must mention that I don't have any theme specified. The only telerik files included in my project are the "telerik.common.min.css", "telerik.default.min.css" and the Scripts folder containing the JS files.
Using ".HtmlAttributes(new { style = "font-family: Verdana; etc..." })" on the chart to set the font-family or other font related styles doesn't work.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
内联样式意味着样式实际上位于元素标签上的 DOM 中。
除非您在样式后使用 !important 声明,否则您无法真正在外部 CSS 中定位它们。 (据我所知)
例如
Inline styles mean that the styles are actually in the DOM on the elements tag.
You can't really target them in the external css unless you use the !important declaration after the style. (as far as I'm aware)
e.g.