Pergunta

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

Foi útil?

Solução

Currently you have content without spaces:

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

Outras dicas

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;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top