如何在Bootstrap中内联多个〈p〉 元素?
我的当前代码:
<div className="container d-inline-flex">
<p className="text-nowrap">
This is sentence number 1.
</p>
<p className="text-nowrap">
This is sentence number 2, which is a bit longer.
</p>
<p className="text-nowrap">
This is sentence number 3 and is the longest sentence by far.
</p>
</div>
The texts overflow the sidebar due to "text-nowrap". However, "text-wrap" would wrap the text to the next line of the <p> tag instead at the very beginning of the new line.
你能解决我的可耻的,自满的努力?
额外的好处:我期待着绕过默认的〈p〉行为,它忽略了多个空格
即〈p〉“你好邻居”-〉“你好邻居”
1条答案
按热度按时间brtdzjyr1#
你还没有提供任何CSS也没有Bootstrap的版本,这是非常糟糕的问题。
但是,您应该了解显示属性,有两种方法可以通过CSS实现您想要的结果:
或者通过在HTML元素上提供Bootstrap的类:
只是要注意:套用至所有中断点(从
xs
到xl
)的显示公用程式类别中没有中断点缩写。这是因为这些类别是从min-width: 0;
及以上套用的,因此不受媒介查询的限制。不过,其馀的中断点会包含中断点缩写。因此,类的命名格式为:
其中,
value
为以下值之一:媒体查询会影响具有给定断点或更大断点的屏幕宽度。例如,.d-lg-none设置显示:无;在lg和xl屏幕上。
至于空格(使其显示),实际上有3种方法实现它:
:<p>There are two spaces between these words.</p>
 
:<p>There are two spaces between these words.</p>
<pre> </pre>
-您只需在标记内键入内容即可。