DataTables JQuery插件和Rails表样式(DataTables JQuery plugin and Rails table styling)
我上周刚拿起Ruby for Rails,我猜我的资产管道存在问题。 具体来说,我想覆盖Rails 4应用程序中DataTables表的默认样式,但更改custom.css.scss什么都不做。 样式显然来自dataTables / jquery.dataTables。 我所要做的就是对表格进行条纹处理,使交替的行具有不同的背景颜色,沿着以下行:
tr.odd { background-color: pink; } tr.even { background-color: red; }
确切地说,这个datatables.css文件安装在我的应用程序的文件树中,以便我可以编辑或替换它,或者如果它不是本地的,我可以在哪里安装我自己的自定义文件来覆盖其规范?
application.css:
*= require_self *= require_tree . *= require jquery.ui.core *= require jquery.ui.theme *= require dataTables/jquery.dataTables
注意:如果我删除了jquery.dataTables要求,我的custom.css.scss生效。
的Gemfile:
# Use jquery as the JavaScript library gem 'jquery-rails' # JQuery UI gem 'jquery-ui-rails' # Datatables JQuery plugin gem 'jquery-datatables-rails', git: 'git://github.com/rweng/jquery-datatables-rails.git'
编辑:
请注意:我试图在.app / assets / datatables / jquery.dataTables.css下包含一个名为jquery.datatables.css的样式表,但Rails只是忽略它。 这个想法来自这篇文章 ,但要么我误解了作者所说的内容 ,要么在Rails 4中无效。
I just picked up Ruby for Rails last week, and I'm guessing that I have some problems with the asset pipeline. Specifically, I want to override the default styling of the DataTables table in my Rails 4 application, but changing custom.css.scss does nothing. The styling is apparently coming from dataTables/jquery.dataTables. All I'm trying to do is to stripe the table so that alternating rows have different background colors, along the lines of:
tr.odd { background-color: pink; } tr.even { background-color: red; }
Where, exactly, is this datatables.css file installed in my application's file tree so that I can edit or replace it, or if it's not local, where can I install my own custom file to override its specifications?
application.css:
*= require_self *= require_tree . *= require jquery.ui.core *= require jquery.ui.theme *= require dataTables/jquery.dataTables
Note: If I remove the jquery.dataTables requirement, my custom.css.scss takes effect.
gemfile:
# Use jquery as the JavaScript library gem 'jquery-rails' # JQuery UI gem 'jquery-ui-rails' # Datatables JQuery plugin gem 'jquery-datatables-rails', git: 'git://github.com/rweng/jquery-datatables-rails.git'
Edit:
Just to note: I've tried to include a stylesheet called jquery.datatables.css under .app/assets/datatables/jquery.dataTables.css, but Rails just ignores it. The idea came from this article, but either I'm misinterpreting what the author is saying or it doesn't work in Rails 4.
原文:https://stackoverflow.com/questions/19991137
最满意答案
如果你想要的话,你可以使用带有SVG文本的数据URI ...
<img src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><text x="0" y="35">URL</text></svg>'>
You can just use a data URI with the SVG text in it if you want...
<img src='data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><text x="0" y="35">URL</text></svg>'>
相关问答
更多-
vvvv / SVG无法呈现文本(vvvv/SVG not rendering text)[2022-01-16]
尝试添加这个: SvgContentNode newContent = new SvgContentNode(); newContent.Content = "Text"; txt.Nodes.Add(newContent); try to add this: SvgContentNode newContent = new SvgContentNode(); newContent.Content = "Text"; txt.Nodes.Add(newContent); -
使svg图像流畅(Making svg image fluid)[2019-12-03]
虽然你可以在SVG上设置height和width ,但你真的应该在调整大小之前设置一个视图框... -
如果你想要的话,你可以使用带有SVG文本的数据URI ... You can just use a data URI with the SVG text in it if you want...