2017-01-16 14 views
0

私のタイトルは中央になりません。あなたが見ることができるように、サブタイトルは大丈夫ですが、タイトルは左のほうです。これをどうすれば解決できますか? ウェブサイトリンク:http://st358373.cmd16c.cmi.hanze.nl/portfolio.htmlタイトルは中央になりません

HTML:

<div class="titel">Portfolio</div> 
<div class="subtitel">Hier is een selectie van recentelijk werk.</div> 

CSS:基本的に

.titel { 
    font-family: Raleway; 
    font-size: 52px; 
    color:  #3b3d40; 
    text-align: center; 
    font-weight: 700; 
    margin-top: 20px; 
    display:  block; 
} 

.subtitel { 
    font-family: Adobe Caslon Pro; 
    font-size:  18px; 
    text-align: center; 
    margin-top: 40px; 
    margin-bottom: 50px; 
} 
+0

あなたのソーシャルメディアのアイコンがそれを超える推進している確認してください。 –

+0

ソーシャルアイコンコンテナなしでコードが正しく実行され、テストされたばかりです – SergioAMG

答えて

3

あなたのウェブサイトの問題は、ソーシャルアイコンが右側に浮かび上がっていることです。したがって、タイトルコンテナをクリアする必要があります。そのために、あなたがする必要があるすべては参考のためにあなたの.titel

ためclear: right;を追加することで、MDN documentation on the clear property

-1

、予想通り、仕事スニペットを見てとる必要があります。

.titel { 
 
    font-family: Raleway; 
 
    font-size: 52px; 
 
    color: #3b3d40; 
 
    text-align: center; 
 
    font-weight: 700; 
 
    margin-top: 20px; 
 
    display: block; 
 
} 
 

 
.subtitel { 
 
    font-family: Adobe Caslon Pro; 
 
    font-size: 18px; 
 
    text-align: center; 
 
    margin-top: 40px; 
 
    margin-bottom: 50px; 
 
}
<div class="titel">Portfolio</div> 
 
<div class="subtitel">Hier is een selectie van recentelijk werk.</div>

また、次のように.titelを作ってみることができます。

display: inline-block; 
width: 100%; 

もう一つの方法は、divの.social<div style="clear:both"></div>を追加することです。

0

.titel { 
 
    font-family: Raleway; 
 
    font-size: 52px; 
 
    color: #3b3d40; 
 
} 
 

 
.subtitel { 
 
    font-family: Adobe Caslon Pro; 
 
    font-size: 18px; 
 
} 
 

 
.center { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 
    transform: translate(-50%, -50%); 
 
    -ms-transform: translate(-50%, -50%); /* IE 9 */ 
 
    -webkit-transform: translate(-50%, -50%); /* Chrome, Safari, Opera */ 
 
    text-align: center; 
 
}
<body> 
 
    <div class="center"> 
 
    <div class="titel">Portfolio</div> 
 
    <div class="subtitel">Hier is een selectie van recentelijk werk.</div> 
 
    </div> 
 
</body>

関連する問題