2017-07-08 59 views
2

请检查jsFiddle link并说明为什么填充在div容器内不可见?填充在div块内不可见?

body { 
 
    background-color: #B8C4BB; 
 
} 
 

 
.container { 
 
    text-align: center; 
 
} 
 

 
.section_two { 
 
    border: 2px solid red; 
 
    padding: 10 px; 
 
}
<div class="container"> 
 
    <div class="section"> 
 
    Change the value of the color property to see how it changes the text color of this element. 
 
    </div> 
 
    <div class="section_two"> 
 
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt, alias, aliquid fugiat dolorem repudiandae quidem. Molestiae illum pariatur officia voluptate cumque. Necessitatibus earum consequuntur explicabo minus ratione mollitia illum nam. 
 
    </div> 
 
</div>

+0

你使用任何CSS框架? –

+0

感谢@Wasi Ahmad格式化它。我在这里是新的,所以没有意识到这些格式化选项。 –

+0

没有简单的css @ChandraShekher –

回答

3

你只是打字错误。

use padding property 

like: padding: 10px; 
insteade of: 10 px; 

Fiddle demo

+0

非常感谢你的朋友。我多么愚蠢! –

+0

欢迎兄弟,它发生了。 – Jainam

+0

如果这个答案对你有帮助,那么请批准.. !! – Jainam

1

你的CSS像下面:

.section_two { 
    border: 2px solid red; 
    padding: 10 px; 
} 

价值填充是无效的。它应该是padding: 10px10px之间没有空格

1

它不起作用,因为您已将空间放置在10和px之间。它应该像下面的代码。

.section_two { 
    border: 2px solid red; 
    padding: 50px; 
}