簡體   English   中英

如何縮進文本而不在HTML代碼中使用邊距或填充?

[英]How to indent text without using margin or padding in html code?

p內的文本應與h3元素在同一行中開始,就像在圖像波紋管中一樣,但不要使用marginpadding 有什么解決辦法嗎?

圖片

 .inner h1, h3{ display: inline-block; vertical-align: text-bottom; } 
 <div class="inner"> <h1>1.</h1> <h3>Download app</h3> <h3>Free</h3> <p> Some text here Some text here Some text here</p> <p> Some text here Some text here Some text here</p> </div> 

您可以為此簡單地使用ol list:

 <ol> <li> <h3>Download app<br/>Free</h3> <p> Some text here Some text here Some text here<br/>Some text here Some text here Some text here</p> </li> </ol> 

p標簽加上text-indent ,如下所示:

.inner p {
  text-indent: 23px;
}

 .inner h1, h3{ display: inline-block; vertical-align: middle; } .inner p { text-indent: 23px; } 
 <div class="inner"> <h1>1.</h1><h3> Download app</h3> <h3>Free</h3> <p> Some text here Some text here Some text here</p> <p> Some text here Some text here Some text here</p> </div> 

使用flex-box可以“拉伸” h1以占據右側的整個高度。

 .inner { display: flex; } h1, h3 { margin: 0; } 
 <div class="inner"> <h1>1.</h1> <div> <h3>Download app Free</h3> <p> Some text here Some text here Some text here</p> <p> Some text here Some text here Some text here</p> </div> </div> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM