2016-03-05 97 views
-2

我嘗試添加頂部空間到我的字幕,但它不起作用。沒關係,當我將行間隔頂部放到行上時 - 如何將間隔頂部添加到主標題?
HTML填充不起作用

<div class="container-fluid" id="about"> 
    <div class="row"> 
      <mainsubtitle class="spacer-top">Something</mainsubtitle> 
    </div> 
</div> 

CSS

#about{ 
text-align: center; 
background-color: #ffffff;} 

mainsubtitle{ 
padding-top: 50px; 
font-family: 'Lato Regular', 'Lato'; 
font-weight: 400; 
font-style: normal; 
font-size: 36px; 
color: #000; 
text-align: center;} 

.spacer-top { 
padding-top: 100px; 
padding-bottom: 0px;} 
+3

自定義元素,例如你在這裏很可能有在瀏覽器中不尋常的相互作用。使用適當的sematic **當前** HTML標記以保持一致性。 –

+0

你的代碼的完整上下文是什麼?是否可以顯示更多的HTML? – PavKR

+0

填充在'上工作得很好 - 它只是不會做你認爲它做的事情。但是你沒有恰當地描述你想要發生的事情。 – Alohci

回答

0

不知道爲什麼你正在做這樣的元素和自定義元素並不總是支持,但是這個代碼工作正常:

HTML:

<div class="container-fluid" id="about"> 
    <div class="row"> 
      <div id="mainsubtitle">Something</div> 
    </div> 
</div> 

CSS:

#about{ 
text-align: center; 
background-color: #ffffff;} 

#mainsubtitle{ 
padding-top: 50px; 
font-family: 'Lato Regular', 'Lato'; 
font-weight: 400; 
font-style: normal; 
font-size: 36px; 
color: #000; 
text-align: center;} 

小提琴 - https://jsfiddle.net/ae5jcxe5/