2017-01-16 6 views
0

Meine Titel werden nicht zentriert. Wie Sie sehen können, ist der Untertitel in Ordnung, aber der Titel ist viel mehr nach links. Wie kann ich das beheben? Die Website-Link: http://st358373.cmd16c.cmi.hanze.nl/portfolio.htmlTitel wird nicht zentriert

Die HTML:

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

Die 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

Ihre Social-Media-Ikonen es über drängen. –

+0

Ihr Code läuft korrekt ohne den Social Icons Container, nur getestet – SergioAMG

Antwort

3

Das Problem mit Ihrer Website ist, dass Ihre sozialen Symbole nach rechts schweben. Daher müssen Sie den Titelcontainer löschen. Dazu alles, was Sie tun müssen, ist clear: right; für Ihre .titel

Als Referenz hinzufügen, überprüfen Sie die MDN documentation on the clear property

-1

Grundsätzlich, das wie erwartet funktionieren sollte, einen Blick auf Schnipsel nehmen:

.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>

Sie können auch .titel wie folgt versuchen zu machen:

display: inline-block; 
width: 100%; 

Ein anderer Weg ist hinzuzufügen <div style="clear:both"></div> unter div .social.

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>

Verwandte Themen