Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why is this tetx not overflowing on the x axis even though I have a fixed width and the <p tag is set to display: block?

I need the text to overflow on the X axis just to reproduce some issue that I’m having on a bigger project. I leave a simple snippet, so you can tell me where I’m doing it wrong. Thanks!

.article {
  background-color: rgb(236, 161, 161);
  width: 20em;
}

.article p {
  display: block;
}
    <article class="article">
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Perferendis deleniti iure quidem distinctio officia voluptates similique molestiae culpa? Perferendis, velit maiores nobis maxime aut facere eaque quis voluptas accusamus commodi.</p>

    </article>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you want the p tag to overflow on the x-axis, you simply need to tell it not to wrap using the white-space property:

p{ 
    white-space: nowrap;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading