CSS 未应用段落“<p>”填充

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2426449/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:41:39  来源:igfitidea点击:

paragraph "<p>" padding not applied

csspaddingparagraph

提问by Rilien

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.)

如何让段落在两边缩进?(我尝试了 15px 而不是 15(编辑 - 但仅限前两个),我也尝试用逗号分隔数字,就像我在谷歌上找到的一个例子。)

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

上面的代码在body中的一个div中,不涉及其他div或tables等。

The div is defined:

div 定义:

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

Thanks for any help.

谢谢你的帮助。

回答by nickf

15? 15 what? Have you considered using units?

15?15什么?您是否考虑过使用单位

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

回答by Klaus Byskov Pedersen

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> 

回答by Manuel Marquez

Maybe you have a previous line like this:

也许你有这样一行:

p { display: inline }

This CSS disablethe use of padding.

CSS 禁用填充的使用。