2017-07-08 122 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; 
}