Вопрос

im looking for center my website in the middle of the browser. This is my website:

http://marcosballester1.hol.es/test/test2.html

Left side is correctly centered, but right side no. Actual Code:

<style>
.wrapper {
    width: 900px;
    margin: auto;
}
</style>

<div class="wrapper">
HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello
</div>

Thanks

Это было полезно?

Решение

Currently you have content without spaces:

.wrapper {
    width: 900px;
    margin: auto;
    word-wrap: break-word; // this rule will resolve your problem
}

Другие советы

Since your text is in unbreakable, you need to use word-wrap property with break-word value:

Indicates that normally unbreakable words may be broken at arbitrary points if there are no otherwise acceptable break points in the line.

#wrapper { 
    width: 50%;
    margin: 0 auto;
    word-wrap: break-word;
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top