Si vous voulez une solution uniquement en HTML, nous pouvons simplement utiliser la fonction pre
tag. Elle définit un "texte préformaté", ce qui signifie qu'elle ne met pas en forme le retour à la ligne. Voici un exemple rapide pour expliquer :
div {
width: 200px;
height: 200px;
padding: 20px;
background: #adf;
}
pre {
width: 200px;
height: 200px;
padding: 20px;
font: inherit;
background: #fda;
}
<div>Look at this, this text is very neat, isn't it? But it's not quite what we want, though, is it? This text shouldn't be here! It should be all the way over there! What can we do?</div>
<pre>The pre tag has come to the rescue! Yay! However, we apologise in advance for any horizontal scrollbars that may be caused. If you need support, please raise a support ticket.</pre>