[英]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.我需要文本在 X 轴上溢出只是为了重现我在更大项目中遇到的一些问题。 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>
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
标签在 x 轴上溢出,您只需要使用white-space属性告诉它不要换行:
p{
white-space: nowrap;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.