我正在用Typora写一个文档,我需要一个分段符,它是中间有文本的一行。整个文档应该可以导出到pdf。result
我最近试过了,但在导出为pdf时不起作用:
h3 {
color: #015573;
text-align: center;
font-size: 0.8em;
position: relative;
margin:0;
text-transform: uppercase;
}
h3 span {
background-color: white;
padding: 0 0.3em;
}
h3:before{
content:"";
display: block;
position: absolute;
z-index:-1;
top: 50%;
width: 100%;
border-bottom: 2px solid #015573;
}发布于 2019-05-17 15:01:44
尝试使用下面的代码。它运行良好。您可以导出到pdf没有任何问题。我没有使用background-color: white;属性,因为默认情况下,任何导出的pdf的背景颜色都是白色。顺便说一句,如果你为Typora使用了黑色主题,你可以指定该属性。它不会影响pdf文件中导出的样式。
h3 {
color: #015573;
text-align: center;
font-size: 0.8em;
text-transform: uppercase;
overflow: hidden;
}
h3:before,
h3:after {
content: "";
display: inline-block;
height: 2px;
position: relative;
vertical-align: middle;
width: 50%;
background-color: #015573;
}
h3:before {
right: 0.5em;
margin-left: -50%;
}
h3:after {
left: 0.5em;
margin-right: -50%;
}<h3>Heading</h3>
下面是导出的pdf的样子:

发布于 2019-05-14 17:55:46
.fancy {
line-height: 0.5;
text-align: center;
}
.fancy span {
display: inline-block;
position: relative;
}
.fancy span:before {
right: 100%;
margin-right: 15px;
}
.fancy span:before,
.fancy span:after {
content: "";
position: absolute;
height: 5px;
border-bottom: 1px solid black;
top: 0;
width: 600px;
}
.fancy span:after {
left: 100%;
margin-left: 15px;
}<p class="fancy"><span>A fancy subtitle</span></p>
https://stackoverflow.com/questions/56127131
复制相似问题