paragraph “<p>” padding not applied

我只是一个虾纸丫 提交于 2020-01-03 08:38:11

问题


The following three pieces of code behave exactly the same:

<p {padding: 0 15 0 15}>  A paragraph of text here...  </p>

<p> A paragraph of text here... </p>

<p style="padding: 0 15 0 15">  A paragraph of text here...  </p>

How do I get the paragraph indented on both sides? (I tried 15px instead of 15 (EDIT - but only on the first two), I also tried separating the numbers with commas, like an example I found on Google.)

The above code is in a div which is in the body, no other divs or tables, etc. are involved.

The div is defined:

<div style="background-color: white; color: black; overflow:auto">

Thanks for any help.


回答1:


15? 15 what? Have you considered using units?

<p style="padding: 0 15px">foo</p>



回答2:


Change:

<p {padding: 0 15 0 15}>  A paragraph of text here...  </p> 

to:

<p style="padding: 0px 15px 0px 15px">  A paragraph of text here...  </p> 



回答3:


Maybe you have a previous line like this:

p { display: inline }

This CSS disable the use of padding.



来源:https://stackoverflow.com/questions/2426449/paragraph-p-padding-not-applied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!