Pour HTML:
<div id="smallBoxWithLotsOfText">There is way more text in here than what
I have typed. I mean, this text is long. There is lots of it.
You can't even imagine how long this text is gonna get. No joking.
It's long; it's very, very long. It keeps going, and going, and going.
It's the Energizer Bunny of text. Like, seriously dude. It's crazy.
Absolutely crazy.
</div>
Essayez CSS:
#smallBoxWithLotsOfText {
width: 100%;
height: 100px;
overflow: auto;
}
La propriété hauteur indique la case à quelle hauteur soit. La propriété overflow indique à la boîte d'ajouter une barre de défilement lorsque le contenu est plus grand, mais pas toujours une barre de défilement (comme le fait scroll
).
Vous pouvez see this in action.
Ironie du sort, votre texte n'a pas été assez longtemps . J'ai dû réduire la taille de ma fenêtre pour faire apparaître la barre de défilement. – thirtydot
@thirtydot - "ça a marché sur ma machine" (ha). – justkt