create account

steemit文章排版中标题距离下方内容太近的两种解决方案 by drunkevil

View this thread on: hive.blogpeakd.comecency.com
· @drunkevil · (edited)
$19.98
steemit文章排版中标题距离下方内容太近的两种解决方案
阅读steemit上面文章的时候,有一个让我特别不舒服的地方:文章中的标题距离下方内容太近,如下图所示。

<img src="https://steemitimages.com/DQmQMhgtoGVtYT2mS3YpHAE5BwTJ68FTQ5fVKbAD1tZLWsf/1.png" align="middle" />

查看CSS文件,原因是二级及以下级别的标题marign属性设置的问题:距离上边界2.5rem,下边界只有0.3rem。代码及效果分别如下所示。

    .Markdown h2, .ReplyEditor__body.rte h2 
    {
	    margin: 2.5rem 0 .3rem;
	    font-size: 140%;
	}

<center><img src="https://steemitimages.com/DQmeWdyP91ua2Y3gjsbcLkR1D3PQBMAtC5kpvcsXcCsRRP7/2.png" align="middle" /></center>

解决的办法有两种:**修改CSS样式**和**在标题后面插入空白段落**。

<h2 style="margin: 1.5rem 0 1.5rem;">方法一:修改CSS样式</h2>

我们没法直接修改steemit的CSS文件,能做的只有修改自己的文章排版方式。Markdown的好处之一是支持html语法,可以通过内联CSS的方式来设置我们想要的样式。而内联CSS的优先级高于外部文件,也就不会受到steemit原始CSS文件的限制。

实现方式如下,**在Markdown编辑器中写文章的时候不用“#”来设置标题,而是采用下面的html语法直接设置想要的标题级别**。

    <h2 style="margin: 1.5rem 0 1.5rem;">这里是标题内容</h2>

<p></p>
效果如上面的标题所示。完美的解决了我的强迫症需要。

## 方法二:在标题后面插入空白段落
<p> </p>

如果你觉得上面的方法有点麻烦,还有一种最简单的方法是:直接在标题下面插入一个空白段落,效果就是这里你看到的。

    ## 这里是标题内容
    <p> </p>


<p> </p>

以上供参考,希望对同样有点强迫症的你有用。


------------

本文完,以下是近期的其他文章:


- [推荐两部韩国电影和一本关于韩国的书](https://steemit.com/cn/@drunkevil/moives-and-book-from-south-korea)
- [2012~2015:读研究生的三年](https://steemit.com/cn/@drunkevil/over-three-years)
- [打电话投诉了一次长城宽带,结果超出了我的预期](https://steemit.com/cn/@drunkevil/customer-complaint)
- [复旦大学校园里那些值得一看的地方](https://steemit.com/cn/@drunkevil/campus-of-fudan)
- [再次回到母校,偶遇复旦大学的几位老校长](https://steemit.com/cn/@drunkevil/presidents-of-fudan-university)


------------
<center>
<p>
<img src="https://steemitimages.com/DQmXZVWSwFDbuFpBx7qXk3XKvwZmw4CigvwuYnoUBL3a9xw/upvote.png" >
<br>
您的点赞(Upvote),转帖(Resteem),留言(Reply)是对我最大的鼓励,谢谢!<a href="https://steemit.com/@drunkevil">@drunkevil</a>
</p>
</center>

------------
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 41 others
properties (23)
authordrunkevil
permlinkmodify-the-title-style-of-steemit
categorycn
json_metadata{"tags":["cn","cn-reader","steemit"],"image":["https://steemitimages.com/DQmQMhgtoGVtYT2mS3YpHAE5BwTJ68FTQ5fVKbAD1tZLWsf/1.png","https://steemitimages.com/DQmeWdyP91ua2Y3gjsbcLkR1D3PQBMAtC5kpvcsXcCsRRP7/2.png","https://steemitimages.com/DQmXZVWSwFDbuFpBx7qXk3XKvwZmw4CigvwuYnoUBL3a9xw/upvote.png"],"app":"steemit/0.1","format":"markdown","links":["https://steemit.com/cn/@drunkevil/moives-and-book-from-south-korea","https://steemit.com/cn/@drunkevil/over-three-years","https://steemit.com/cn/@drunkevil/customer-complaint","https://steemit.com/cn/@drunkevil/campus-of-fudan","https://steemit.com/cn/@drunkevil/presidents-of-fudan-university","https://steemit.com/@drunkevil"]}
created2017-09-21 17:44:18
last_update2017-09-22 09:13:06
depth0
children4
last_payout2017-09-28 17:44:18
cashout_time1969-12-31 23:59:59
total_payout_value15.048 HBD
curator_payout_value4.934 HBD
pending_payout_value0.000 HBD
promoted1.000 HBD
body_length1,699
author_reputation8,031,279,202,083
root_titlesteemit文章排版中标题距离下方内容太近的两种解决方案
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id15,544,286
net_rshares7,633,670,205,177
author_curate_reward""
vote details (105)
@bestmz ·
感谢分享实用性排版技巧。
properties (22)
authorbestmz
permlinkre-drunkevil-modify-the-title-style-of-steemit-20170922t025802517z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2017-09-22 03:03:27
last_update2017-09-22 03:03:27
depth1
children1
last_payout2017-09-29 03:03:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length12
author_reputation22,152,342,570,197
root_titlesteemit文章排版中标题距离下方内容太近的两种解决方案
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,577,826
net_rshares0
@drunkevil ·
谢谢你的关注,希望对大家有用。
properties (22)
authordrunkevil
permlinkre-bestmz-re-drunkevil-modify-the-title-style-of-steemit-20170922t033227686z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2017-09-22 03:32:27
last_update2017-09-22 03:32:27
depth2
children0
last_payout2017-09-29 03:32:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation8,031,279,202,083
root_titlesteemit文章排版中标题距离下方内容太近的两种解决方案
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,579,409
net_rshares0
@drunkevil ·
使用steemit编辑器修改文章时不能插入本地图片吗?
properties (22)
authordrunkevil
permlinkre-drunkevil-modify-the-title-style-of-steemit-20170921t180108576z
categorycn
json_metadata{"tags":["cn"],"app":"steemit/0.1"}
created2017-09-21 18:01:12
last_update2017-09-21 18:01:12
depth1
children0
last_payout2017-09-28 18:01:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length27
author_reputation8,031,279,202,083
root_titlesteemit文章排版中标题距离下方内容太近的两种解决方案
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,545,568
net_rshares0
@jeannababara ·
Very nice completion of post! @drunkevil  Loved the pictures and description.
properties (22)
authorjeannababara
permlinkre-drunkevil-modify-the-title-style-of-steemit-20170921t175805473z
categorycn
json_metadata{"tags":["cn"],"users":["drunkevil"],"app":"steemit/0.1"}
created2017-09-21 17:58:06
last_update2017-09-21 17:58:06
depth1
children0
last_payout2017-09-28 17:58:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length77
author_reputation-854,165,099,059
root_titlesteemit文章排版中标题距离下方内容太近的两种解决方案
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,545,329
net_rshares0