Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
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>

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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:

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

article p{
    display: block;

    /* Do NOT break the text onto a new line when it reaches the container bounds. */
    white-space: nowrap;
}
<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>

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!