我有一些文本被标签更改打断了。显然,正文的第二部分换行开始。我怎样才能把它放在一行中?我尝试添加 display: inline
到 <p>
.但这具有“名称”位置的效果。改变了。
<span id="page170" title="170">
<p class="_10_Lesetext_02_Txt_lb"><span class="semibold-semicondensed _idGenCharOverride-1">Name.</span> Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text be</p>
</span>
<span id="page171" title="171">
<p class="_10_Lesetext_02_Txt"> together Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
</span>
编辑
在这里你可以看到它应该是什么样子:
最佳答案
使用 div
而不是 span
因为 span
不能包含 p
作为 child 然后这样做:
UPDATE 将其包裹在 block 元素中,并提供一个text-indent
然后添加一些padding-left
article {
text-indent: -2em;
padding-left: 50px
}
div,
p {
display: inline
}
p._10_Lesetext_02_Txt_lb {
font-size: 0.783em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1.223;
margin-left: 9px;
margin-bottom: 0;
margin-right: 0;
margin-top: 0;
orphans: 1;
page-break-after: auto;
page-break-before: auto;
text-align: left;
text-decoration: none;
text-transform: none;
widows: 1;
}
p._10_Lesetext_02_Txt_lb_tab {
font-size: 0.783em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1.223;
margin-bottom: 0;
margin-right: 0;
margin-top: 0;
orphans: 1;
page-break-after: auto;
page-break-before: auto;
text-align: left;
text-decoration: none;
text-transform: none;
widows: 1;
}
p._10_Lesetext_02_Txt {
font-size: 0.783em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1.223;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
orphans: 1;
page-break-after: auto;
page-break-before: auto;
text-align: left;
text-decoration: none;
text-transform: none;
widows: 2;
}
span.semibold-semicondensed {
font-family: "Source Sans Pro Semibold", sans-serif;
font-size: 0.75em;
font-style: normal;
font-weight: 600;
}
span._idGenCharOverride-1 {
font-size: 0.958em;
}
<article>
<div id="page170" title="170">
<p class="_10_Lesetext_02_Txt_lb"><span class="semibold-semicondensed _idGenCharOverride-1">Name.</span> Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text be</p>
</div>
<div id="page171" title="171">
<p class="_10_Lesetext_02_Txt">together Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</p>
</div>
</article>
关于html - css如何把元素放在一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41674202/