gpt4 book ai didi

html - CSS 填充规则被忽略?

转载 作者:行者123 更新时间:2023-11-28 04:08:03 24 4
gpt4 key购买 nike

基本上,当我尝试为 TRBL 定义不同的填充量时,规则会被忽略,但当我只定义一个填充量时,规则会起作用。

相关html如下:

<div class="content">
<div class="contenttext">
<h1>Hello.</h1>
<p>Test text, needs more testing.</p>
</div>
</div>

CSS如下:

* 
{
margin: 0px;
padding: 0px;
}

body
{
font: normal 100% 'trebuchet ms', arial, sans-serif;
}

.content
{
background: #d9d5b7;
width: 100%;
height: 600px;
}

.contenttext
{
background: #FFFFFF;
width: 750px;
margin: 0 auto;
height: 500px;

padding: 25px;
}

.contenttext h1
{
font: bold 150% 'gothic century', arial, sans-serif;
color: #585858;

margin: 0px;
padding: 15px, 0px, 15px, 0px;
}

p
{
color: #707070;
}

来自 Chrome 的图片:

enter image description here

enter image description here

如果我在这里遗漏了一些非常基本的东西,我深表歉意,我才刚刚开始使用 xhtml/css,老实说,我发现它非常令人沮丧。

如果您需要完整的代码来确定问题,请大声喊叫,我会尽快上传。

最佳答案

padding: 15px 0;

值之间没有逗号

更新:样式值中的数字和 px 之间也没有空格

关于html - CSS 填充规则被忽略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8068613/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com