html中p標籤行間距的問題

來源:互聯網
上載者:User

標籤:text   上下   設定   實現   自動   oct   log   span   文字   

使用CSS行高樣式line-height可以設定調整p行間距,但是同時會影響每行文字間的上下間距,所以使用line-height雖然可以用來設定html p 行距離間隔,但是不是很實用,一般line-height只設定上下文字間間距。

使用margin實現p與p上下行間距與br換行一樣零距離改變
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style> p{ margin:0 auto};/* 設定p上下距離為0,左右自動 */ </style> </head> <body> <p>第一段1<br />第一段2</p> <p>第二段1<br />第二段2</p> <p>第三段1<br />第三段2</p> </body> </html> 

設定margin:0 auto;可以實現p行距離為零。

html中p標籤行間距的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.