MarkDown-Here 的样式分享

最近在使用MarkDown写公众号文章,并使用MarkDown Here进行排版。发现效果还不错,这边分享一个 MarkDown Here的CSS样式。

/*markdown here 的全局配置*/
.markdown-here-wrapper {
  font-size: 16px;
  line-height: 1.8em;
  /*em指的是相对单位,当前对象内字体的尺寸,默认浏览器16px*/
  /*http://www.w3school.com.cn/cssref/css_units.asp*/
  letter-spacing: 0.1em;
}

pre,code {   
  /*,逗号连接是并集选择器*/
  font-size: 14px;
  font-family: Roboto,'Courier New',Consolas,Inconsolata,Courier,monospace;
  margin: auto 5px;
}

/*设置pre 和code的整体属性,pre可以把div中的/r/n保存下来显示,而code则用浏览器的方式渲染*/
code {
  white-space: pre-wrap;
  border-radius: 2px;
  display: inline;
}
/*display 的属性为指定元素框的类型*/
/*margin: 0为默认值,auto为浏览器自动计算的外边距,外边距属性*/
/*border-radius: div元素的圆角框*/
/*write-space:如何处理元素内空白行,回车or忽略,nowrap不换行,pre-wrap换行*/
/*http://www.w3school.com.cn/cssref/pr_text_white-space.asp*/


pre {  
  /*pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。*/
  font-size: 15px;
  line-height: 1.4em;
  display: block; !important;  /*在ie6以上的浏览器中,设置优先级,覆盖预先设置的属性 !important*/
}

pre code {  /*空格连接是后代选择器,外层在前内层在后; >连接是子元素选择器*/
  white-space: pre;
  overflow: auto;   /*内容益处元素框时候的行为*/
  border-radius: 3px;
  padding: 1px 1px;
  display: block !important;
}

/*各种选择器:https://blog.csdn.net/m0_38070602/article/details/69950795*/
/*pre code 的解释:http://www.cnblogs.com/lizonghui/archive/2012/09/18/2692355.html*/
strong,b{  
  /*strong表示强调,用<b>粗体显示,也可以自定义自己的强调方式*/
  color: #BF360C;
}

em,i {  
  /*em表示强调,用<i>标签斜体显示,也可以自定义自己的强调方式*/
  color: #009688;
}

hr {   
  /*水平线分割---*/
  border: 1px solid #BF360C;
  margin: 1.5em auto;
}

p {  
  /*段落选择器*/
  margin: 1.5em 5px !important;
  /*颜色*/
  /*color:#d6a841;*/   
  /*字体*/
  font-family:'微软雅黑';
  /*字号*/
  font-size:15px;
  /*行间距,可用百分比,数值倍数,像素设置,还包括text-indent缩进、letter-spacing字间距、*/
  line-height:100%  2  100px;
  /*段间距,一般用margin属性调整*/
  margin-bottom:20px;
  /*页边距用padding属性调整*/
}

/*表格和*/
table,pre,dl,blockquote,q,ul,ol {
  margin: 10px 5px;
  /*并集选择器:表格、预格式化、定义列表、块引用、短引用、无序列表、有序列表*/
}

ul,ol {  
  /*无序、有序列表*/
  padding-left: 15px;
}

li {  
  /* 定义列表中的项目*/
  margin: 10px;
}

li p {  
  /*li列表元素中的后代选择器,包含选择器,应用于li中的p*/
  margin: 10px 0 !important;
}

ul ul,ul ol,ol ul,ol ol {    
  /*各个后代选择器一起添加属性*/
  margin: 0;
  padding-left: 10px;
}

ul {
  list-style-type: circle;
}
/*无序列表的前缀,circle,square,好多种,同样有序列表ol也可以设置不同的标记*/
/*http://www.w3school.com.cn/cssref/pr_list-style-type.asp*/

dl {
  padding: 0;
}

dl dt {
  font-size: 1em;
  font-weight: bold;  
  /*加粗  意大利斜体*/
  font-style: italic;
}

dl dd {
  margin: 0 0 10px;
  padding: 0 10px;
}
/*各种表格的包含选择器定义,用空格连接*/


blockquote,q {
  border-left: 2px solid #009688;
  padding: 0 10px;  
  /*上右下左的排序,可输入四个值*/
  color: #777;
  quotes: none;
  margin-left: 1em;
}
/*块引用和短引用的样式*/

blockquote::before,blockquote::after,q::before,q::after {
  content: none;
}
/*before 和after属于css伪元素,:before在元素之前插入相应。:after在之后插入*/
/*伪元素用::,伪类用:参考ref。。https://blog.csdn.net/qq_25292481/article/details/52577320*/


/*--------同时设置六级标题的属性,其中!important用于指定优先级>ie6--------------*/
h1,h2,h3,h4,h5,h6 {
  margin: 20px 0 10px;
  padding: 0;
  font-style: bold !important;
  color: #009688 !important;
  text-align: center !important;
  margin: 1.5em 5px !important;
  padding: 0.5em 1em !important;
}

h1 {
  font-size: 24px !important;
  border-bottom: 1px solid #ddd !important;
}

h2 {
  font-size: 20px !important;
  border-bottom: 1px solid #B3B3B3 !important;
}

h3 {
  font-size: 18px;
}

h4 {
  font-size: 16px;
  /*可以针对自己的标题做出个性化设置*/
  color:#d6a841   /*16进制颜色*/
  font-style: bold /*加粗?倾斜*/
  /*---------各种居中方式---------*/
  margin: 0,auto;        /*块级元素居中*/
  text-align: center;    /*行内居中*/
  justify-content: center;  /*对齐*/
  vertical-align: middle;  /*垂直居中*/
  /*ref:   https://www.jianshu.com/p/61c431fd924a*/

}

/*-------------表格元素的设置-----------------*/
table {
  padding: 0;
  border-collapse: collapse;  /*合并边框属性*/
  border-spacing: 0;  
  font-size: 1em;
  font: inherit;
  border: 0;
  margin: 0 auto;
}

tbody {
  margin: 0;
  padding: 0;
  border: 0;
}

table tr {
  border: 0;
  border-top: 1px solid #CCC;
  background-color: white;
  margin: 0;
  padding: 0;
}

table tr:nth-child(2n) {
  background-color: #F8F8F8;
}

table tr th,table tr td {
  font-size: 16px;
  border: 1px solid #CCC;
  margin: 0;
  padding: 5px 10px;
}

table tr th {  /*表格。tableraw,tableheader*/
  font-weight: bold;
  color: #eee;
  border: 1px solid #009688;
  background-color: #009688;
}


----------
可根据markdown的实现自己的**个性化**标记
@strong-char: "**";  /*可以将着重符号替换为自己的个性化符号*/
strong:before,strong:after {
    content: @strong-char;
    display: inline;
}
@em-char: "*";   
em:before,em:after {
    content: @em-char;
    display: inline;
}

代码样式:HyBrid

/*

vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)

*/

/*background color*/
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #1d1f21;
  -webkit-text-size-adjust: none;
}

/*selection color*/
.hljs::selection,.hljs span::selection {
	background: #373b41;
}
.hljs::-moz-selection,.hljs span::-moz-selection {
	background: #373b41;
}

/*foreground color*/
.hljs,.hljs-setting .hljs-value,.hljs-expression .hljs-variable,.hljs-expression .hljs-begin-block,.hljs-expression .hljs-end-block,.hljs-class .hljs-params,.hljs-function .hljs-params,.hljs-at_rule .hljs-preprocessor {
  color: #c5c8c6;
}

/*color: fg_yellow*/
.hljs-title,.hljs-function .hljs-title,.hljs-keyword .hljs-common,.hljs-class .hljs-title,.hljs-decorator,.hljs-tag .hljs-title,.hljs-header,.hljs-sub,.hljs-function {
  color: #f0c674;
}

/*color: fg_comment*/
.hljs-comment,.hljs-javadoc,.hljs-output .hljs-value,.hljs-pi,.hljs-shebang,.hljs-template_comment,.hljs-doctype {
  color: #707880;
}

/*color: fg_red*/
.hljs-number,.hljs-symbol,.hljs-literal,.hljs-deletion,.hljs-link_url,.hljs-symbol .hljs-string,.hljs-argument,.hljs-hexcolor,.hljs-input .hljs-prompt,.hljs-char {
 color: #cc6666
}

/*color: fg_green*/
.hljs-string,.hljs-special,.hljs-javadoctag,.hljs-addition,.hljs-important,.hljs-tag .hljs-value,.hljs-at.rule .hljs-keyword,.hljs-regexp,.hljs-attr_selector {
  color: #b5bd68;
}

/*color: fg_purple*/
.hljs-variable,.hljs-property,.hljs-envar,.hljs-code,.hljs-expression,.hljs-localvars,.hljs-id,.hljs-variable .hljs-filter,.hljs-variable .hljs-filter .hljs-keyword,.hljs-template_tag .hljs-filter .hljs-keyword {
 color: #b294bb;
}

/*color: fg_blue*/
.hljs-statement,.hljs-label,.hljs-keyword,.hljs-xmlDocTag,.hljs-function .hljs-keyword,.hljs-chunk,.hljs-cdata,.hljs-link_label,.hljs-bullet,.hljs-class .hljs-keyword,.hljs-smartquote,.hljs-method,.hljs-list .hljs-title,.hljs-tag {
 color: #81a2be;
}

/*color: fg_aqua*/
.hljs-pseudo,.hljs-exception,.hljs-annotation,.hljs-subst,.hljs-change,.hljs-cbracket,.hljs-operator,.hljs-horizontal_rule,.hljs-preprocessor .hljs-keyword,.hljs-typedef,.hljs-template_tag,.hljs-variable,.hljs-variable .hljs-filter .hljs-argument,.hljs-at_rule,.hljs-at_rule .hljs-string,.hljs-at_rule .hljs-keyword {
  color: #8abeb7;
}


/*color: fg_orange*/
.hljs-type,.hljs-typename,.hljs-inheritance .hljs-parent,.hljs-constant,.hljs-built_in,.hljs-setting,.hljs-structure,.hljs-link_reference,.hljs-attribute,.hljs-blockquote,.hljs-quoted,.hljs-class,.hljs-header {
  color: #de935f;
}

.hljs-emphasis
{
  font-style: italic;
}

.hljs-strong
{
  font-weight: bold;
}

工具推荐

上面的MarkDown Here使用起来很方便,但是在使用过程中发现一个问题:就是文章格式在保存后会乱掉。也没找到好的解决方法。

所以在网上又找了一个工具,使用起来也比较方便。具体地址见:http://md.aclickall.com

我选择了一个标题居中的主题,自己进行了小范围修改。

/*可任意修改样式,或恢复预设值,保存后生效
相对“默认样式”而作的修改会用  红色 标注*/

.output_wrapper
{
     /*此属性为全局*/
     font-size: 16px;
     color: #3e3e3e;
     line-height: 1.8em;
     word-spacing:0px; 
     letter-spacing:0px;
     font-family: "Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei",Arial,sans-serif;   
}
.output_wrapper *
{
  font-size: inherit  ;
  color: inherit;
  line-height: inherit;
  margin: 0px;
  padding:0px;
}

p {
  /*段落*/
  margin: 1.5em 10px;
}

h1,h6 {
  margin: 1.5em 12px;
  font-weight:bold;
  color:#159957;        /*改变了其默认的标题颜色*/
  text-align: center;   /*改变了其默认值,使其标题居中*/
}

h1 {
  font-size: 1.6em  ;
   border-bottom: 1px solid #ddd !important;
}
h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #eee !important;
}
}
h3 {
  font-size: 1.4em;
}
h4 {
  font-size: 1.2em;
}
h5 {
  font-size: 1.3em;
}
h6 {
  font-size: 1.2em;
}

ul,ol {
  padding-left: 32px;
}
ul{ /*无序列表*/
    list-style-type: disc;
}
ol { /*有序列表*/
  list-style-type: decimal;
}
li *  
{
 /* color: #3e3e3e;*/
} 

li{  /*在公众号下,改变不了li符号的属性(如颜色),并会影响其子元素的属性;而在其它博客平台中,则能正常使用*/ 
    margin-bottom: 0.5em;
/*  color:#159957; */    
}
.code_size_default  /*代码块默认size*/
{
  line-height: 18px;
  font-size: 14px; 
  font-weight:normal;
  word-spacing:0px; 
  letter-spacing:0px; 
}
.code_size_tight /*代码块紧凑size*/
{
   line-height: 15px; 
   font-size: 11px; 
   font-weight:normal;
   word-spacing:-3px; 
   letter-spacing:0px; 
}
pre code /*代码块*/
{           
     font-family: Consolas,monospace;
     border-radius: 0px;
}
blockquote { /*引用块*/
  display: block;
  padding: 15px 1rem;
  font-size: 0.9em;
  padding-right: 15px;
  margin: 1em 10px;
  color: #819198;
  border-left: 6px solid #dce6f0;
  background: #f2f7fb;
  overflow: auto;
  overflow-scrolling: touch; 
  word-wrap: normal;
  word-break: normal;  
}
blockquote p {
    margin: 10px;
}

a { /*超链接*/
  text-decoration: none;
  color: #1e6bb8;
  word-wrap:break-word;
}

strong  /*强调*/
{
  font-weight: bold;
}
em /*斜体*/
{
 font-style:italic;
}
del /*删除线*/
{
 font-style:italic;
}
strong em/*强调的斜体*/
{
font-weight: bold;
}

hr {  /*分隔线*/
  height: 1px;
  margin: 1.5rem 10px;
  border: none;
  border-top: 1px dashed #A5A5A5;
}

code /*行内代码*/
{
    word-wrap: break-word;
    padding: 2px 4px;
    border-radius: 4px;
    margin:0 10px;
    color:#e96900;
    background:#f8f8f8;
}
img
{
  display: block;
  margin:0 auto;  /*图片水平居中*/
  /* margin:0 0;  */ /*图片水平居左,如需要请打开*/
  max-width:100%;
}
figcaption/*图片描述文字*/
{
  margin-top:10px;
  text-align:center;
   /* text-align:left;  */ /*当图片水平居左时,请打开*/
  color:#999;
  font-size: 0.7em;
}

/*================表格开始================*/
table
{
 display:table;
 width: 100% ;
 text-align: left;
}
tbody {
  border: 0;
}

table tr {
  border: 0;
  border-top: 1px solid #CCC;
  background-color: white;
 
}

/*隔行改变行的背景色,如需要请打开*/
/*
table tr:nth-child(2n) {
  background-color: #F8F8F8;
}
*/

table tr th,table tr td {
  font-size: 1em;
  border: 1px solid #CCC;
  padding: 0.5em 1em;
  text-align: left;
}
/*表头的属性*/
table tr th {
 font-weight: bold;
  background-color: #F0F0F0;
}
/*================表格结束================*/

/*================数学公式开始================*/
.katex-display {/*块公式*/
  font-size:1.22em; 
}
.katex
{/*行内公式*/
  padding:8px 3px;
}
.katex-display > .katex
{/*块公式*/
   display:inline-block;
   text-align:center;
   padding:3px;
}
.katex img
{/*行内公式对应的图片*/
  display:inline-block;
  vertical-align:middle;
}
/*================数学公式结束================*/

a[href^="#"] sup
{/*注脚*/
  vertical-align:super;
  margin:0 2px;  
  padding:1px 3px; 
  color: #ffffff;
  background:#666666;
  font-size:0.7em;
}

/*================任务列表开始================*/
.task-list-list {
  list-style-type: none;
}
.task-list-list.checked {/*已完成*/
  color: #3e3e3e;
}

.task-list-list.uncheck {/*未完成*/
  color: #bfc1bf;
}
.task-list-list .icon_uncheck,.task-list-list .icon_check {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
}
.task-list-list .icon_check:before
{/*已完成*/
    content: "√";
    border: 2px solid #3e3e3e;
    color:red;
}
.task-list-list .icon_uncheck:before
{/*未完成*/
   content: "x";
   border: 2px solid #bfc1bf;
    color: #bfc1bf;
}
.task-list-list .icon_check:before,.task-list-list .icon_uncheck:before
{/*标志框*/
  padding:2px;
  padding-left: 5px;
  padding-right: 8px;
  border-radius:5px;
}
/*================任务列表结束================*/


.toc
{/*总目录*/
  margin-left:25px;
}
.toc_item
{/*每条目录*/
  display:block;

}
.toc_left
{/*每级目录的缩进*/
  margin-left:25px;
}

原文地址:https://www.cnblogs.com/54chensongxia

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Css常用的排序方式权重分配 排序方式: 1、按类型&#160;如,显示和浮动、定位、尺寸、字体等 2、按字母&#160;按字母顺序排列,优点是规则简单 3、按定义长度&#160;按照样式定义的字符长度排列 各有优劣,实际应用中,推荐使用第一种。&#160;但是如果单靠前端工程师在编写过程中这么做的
原文:https://www.cnblogs.com/wenruo/p/9732704.html 先上效果 基本是用CSS实现的,没有用图片,加一丢丢JS。不过没有考虑太多兼容性。 首先画一个 &lt;!DOCTYPE html&gt;&lt;html lang=&quot;en&quot;&gt;
css属性:word-wrap:break-word; 与 word-break:break-all 的用法; zhangq0123 于 2016-10-19 11:06:12 发布 6475 收藏 9分类专栏: CSS HTML 文章标签: html css版权 CSS同时被 2 个专栏收录8 篇
https://destiny001.gitee.io/color/
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &l
css之background的cover和contain的缩放背景图 对于这两个属性,官网是这样解释的: contain 此时会保持图像的纵横比并将图像缩放成将适合背景定位区域的最大大小。 等比例缩放图象到垂直或者水平其中一项填满区域。 cover 此时会保持图像的纵横比并将图像缩放成将完全覆盖背景
.CSS.MAP文件作用 https://blog.csdn.net/qq_36441169/article/details/102575563 1、简介在写前端代码,使用bootstrap时,发现同一个目录下,不仅仅有.css文件的同时,还存在.css.map文件的存在。在前端页面调试时也发现,映
Jquery mobile 写html时文字太长无法自动换行。 Jquery mobile 1 篇文章0 订阅 订阅专栏 加上这个 style=&quot;word-wrap:break-word;word-break:break-all;&quot; 或者 style=&quot;word-wra
详见:http://www.shagua.wiki/project/3 layui图标:http://www.shagua.wiki/project/3?p=85 JQ手册 :https://www.jc2182.com/jquery/jquery-jiaocheng.html css样式手册:ht
css里面圆形的代码,如何使用纯css实现圆形图像或叶子图像?(代码实例) 网易美学于&#160;2021-08-03 22:15:22&#160;发布946&#160;收藏 文章标签:&#160;css里面圆形的代码 有没有想过如何制作那些各式各样的圆形图像而无需用ps,本篇文章就来给你介绍一下如
css文字超出一行就显示省略号 1,css超出一行用点表示 white-space:nowrap; overflow:hidden; text-overflow:ellipsis; 2,css超出二行用点表示 overflow:hidden; text-overflow:ellipsis; disp
js动态追加数据单独设置某一个元素的样式。 在开发时,我们有很多数据是从后台获取然后展示的,例如列表,最近开发碰到个需求是获取到列表信息之后,不仅仅是拼接展示出来,还需要将其中的第一个li元素设置成其他的样式类,在网上找了一堆的办法都和自身业务需求不一致,没办法自己通过chrome控制台一点点调试,
css3手机端h5商品列表页,两列等分排列技巧 .picture_list {&#x9;width: 100%;&#x9;overflow: hidden}.picture_list&gt;li {&#x9;width: 50%; min-height: 120px;&#x9;float: left;&#x9;padding: 0px 3
css3 transform:scale(x)实现字体的缩放: css3 transform:scale(x)字体的缩放: transform:scale(x),针对于整体的缩放,缩放的整体包括宽,高,背景。这自然对于内联元素就无法使用此属性,最好使用无属性的span转换成块元素或者行内块元素进行设
jq获取第一个子元素并添加class &lt;div class=&quot;main&quot;&gt; &lt;div class=&quot;tit&quot;&gt;颜色&lt;/div&gt; &lt;ul&gt; &lt;li&gt;银色&lt;/li&gt; &lt;li&gt;深灰色
设置背景图片的两种方式,并解决手机端背景图片高度自适应问题 赵世婷&#160;2017-09-19 15:59:43 14372 收藏&#160;5 1 设置背景图片的两种方式: 方式一: .back{undefinedposition: fixed;width: 100%;height: 100%
css层级选择器理论{#ek) E:first-child : 匹配的是E元素,E元素是父元素的第一个子元素 说明:利用 :first-child 这个伪类,只有当元素是另一个元素的第一个子元素时才能匹配。例如,p:first-child 会选择作为另外某个元素第一个子元素的所有 p 元素。一般可能
Css多行字符截取方法详解 时间:2021-07-01 10:21:17 相信有很多同学在写前端页面的时候,都会遇到字符长了需要截取的问题,最简单的方法就是手动去截取,可这样又感觉太low了,今天晚上就来讲讲利用css进行字符的截取,不了解css是如何截取的同学可以和我们一起看看哦! 前言 最近在做
css中content可以用到的字符编码 项目中用到的一些特殊字符和图标 html代码 &lt;div class=&quot;cross&quot;&gt;&lt;/div&gt; css代码.cross{width: 20px;height: 20px;border-radius: 10px;b
CSS 计算属性 calc()的完整指南(上) 2020-05-03 CSS tricks上有一系列的完整指南文章,我后面会翻译这些内容,更新不会一下子完成,而是会分成几个,防止自己因看到文章过长而放弃翻译,一步一个脚印。 CSS有一个特殊的calc()函数,用于做基本的数学运算。下面是一个例子: