Ich schreibe eine Webseite und so weit sieht es so aus: Wie kann ich Text in meiner Bootstrap-Webseite zentrieren?
Ich möchte diesen Text in der Mitte der Seite haben. Der Container mit Text sollte in der Mitte der Seite sein, aber der Text sollte nicht zentriert sein (er sollte eher nach links ausgerichtet sein). Was mache ich falsch?
Mein HTML-Code ist:
<body>
<div class="container">
<div class="row">
<div class="col-lg-12">
<a href="http://www.company.com">
<div class="text-center logo">
<img src="https://upload.wikimedia.org/wikipedia/commons/a/ab/Logo_TV_2015.png">
</div>
</a>
</div>
</div>
<div class="row">
<div class="col-lg-12 info general">
<h3>test sth</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
</div>
<div class="row" id="summary">
<div class="col-lg-12 info">
<h4>sample header</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
</div>
</div>
</body>
und die CSS - neben Bootstrap - wie folgt:
<style>
body {
padding-top: 70px;
font-family: "Helvetica Neue","Open Sans",Arial,sans-serif;
background-color: white;
}
.logo img {
width: 100px;
}
.info {
width:100%;
max-width: 700px;
margin:0 auto;
}
.general {
padding: 24px 20px;
}
</style>
- ===== edit:
nur ein Follow-up , so weit sieht diese Webseite so aus:
| [LOGO] |
| text text text text text te |
| text text text text tex |
| text text text text text text |
| text text text text |
und das ist, was ich erreichen will:
| [LOGO] |
| text text text text text te |
| text text text text tex |
| text text text text text text |
| text text text text |
Sie möchten also, dass der Text vom Container getrennt ist? –
Welchen Inhalt Sie auch immer in der Mitte haben möchten, verwenden Sie text-align: center style auf dem div. und für diejenigen, die Sie in links oder rechts benötigen, verwenden Sie geeignete CSS-Stil auf ihrer jeweiligen div. –