用CSS覆盖“硬连线”风格信息是否可能?(Is it possible to override “hard

编程入门 行业动态 更新时间:2024-10-25 04:16:49
用CSS覆盖“硬连线”风格信息是否可能?(Is it possible to override “hard-wired” style information with CSS?)

我正在为生成html表的Jupyter笔记本写一个扩展 。 Jupyter笔记本可以很好地直接在Github中查看 ,但不幸的是,所有的<style>标签都从html中剥离,而这些是(AFAIK)嵌入CSS的唯一方式。 结果,当在Github上直接查看时,这些表格看起来相当难看。

一种可能的解决方法是使用hard-baked style=...属性,但除了不雅之外,这还不能提供足够的灵活性来正确实现工具提示文本等功能,我想添加这些功能。

如果这些工具提示只是在github上不起作用 ,我不会介意太多,但如果我用通常的CSS方式实现它们,那么所有的工具提示都将始终可见!

如果没有找到CSS信息,是否可以隐藏html元素以隐藏它们,但是可以通过CSS使其可见? 或者更一般地说,是否可以在html中硬编码一个默认样式,但是用合适的CSS子句覆盖它呢?

I'm writing an extension for Jupyter Notebooks that generates html tables. Jupyter notebooks can be nicely viewed directly in Github, but unfortunately all <style> tags are stripped from the html, and those are (AFAIK) the only way to embed CSS. As a result, the tables look rather ugly when directly viewed on Github.

One possible workaround would be to use hard-baked style=... attributes, but apart from being inelegant this also doesn't offer enough flexibility to properly implement features like tooltip text, which I'd like to add.

I wouldn't mind too much if those tooltips just didn't work on github, but if I implement them the usual CSS way then instead all tooltips will be visible all the time!

Is it possible to write html elements in such a way that they will be hidden if no CSS information is found, but can be made visible via CSS? Or, more generally, is it possible to hard-code a default style in html, but override it with proper CSS clauses?

最满意答案

是。 你可以简单地使用!important标签。 一个例子可以是背景颜色: background: #ccc !important;

Yes. you can simply used the !important tag. An example could be for background color: background: #ccc !important;

更多推荐

本文发布于:2023-07-19 09:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1176942.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:风格   信息   CSS   override   hard

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!