做< style>标签在Markdown中工作? [英] Do <style> tags work in Markdown?

查看:130
本文介绍了做< style>标签在Markdown中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个Github的README.md文件,我有不同的表格。内容不同,所以表格宽度也不同。

I'm writing a Github README.md file, and i have diferent tables. The contents are different, so table width is different too.

我想,至少第一列是固定宽度的,所以我试着在所有表格之前加入这个在减价文件中:

I want, at least the first column to be of fixed width, so i tried adding this before all the tables in the Markdown file:

<style>td:nth-child(odd){width:200px}</style>

令人惊讶的是,在我的编辑器预览中工作,但是当提交给github时,文本显示为样式标签剥离,并没有风格应用。

Surprisingly that is working in my editor preview, but when committed to github, the text appears with the style tags stripped, and no style is applied.

我的问题是,如果它可能在github上,并且它是id,我该怎么做。

My questions is if it's possible on github, and id it is, how do i do it.

推荐答案

我自己测试过。

Just tested it myself.

<style>
#foo {color: red}
</style>

<p id="foo">foo</p>

<p style="color: blue">bar</p>

以上呈现为:

#foo {color: red}
<p>foo</p>

<p>bar</p>

GitHub去掉样式标签和属性,以防止您更改页面样式。这可能是出于安全原因。如果您可以将css注入GitHub页面,您可以轻松发起钓鱼攻击。

GitHub strips style tags and attributes preventing you from changing the style on their pages. This is probably for security reasons. If you could inject css into GitHub pages, you could easily launch a phishing attack.

这篇关于做&lt; style&gt;标签在Markdown中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆