如何使文字无法响应?

时间:2017-08-08 19:25:37

标签: css html5

我想让我的文本保留所有格式,无论屏幕的大小如何,但是如果我要使屏幕足够小,它将改变其格式以适应屏幕。

我怎样才能使它保持原始位置和格式化。

<div style="background-color: white; height: 600px; padding: 100px 200px;">

  <br><br><br>

  <h1 style="font-size: 70px;color:#21ce99;">about me</h1>

  <p style="font-size: 20px;color: #0ec998">I'm a Developer and aspiring Entrepreneur <br>from Voorhees, New Jersey in the US.</p>
  <p style="font-size: 16px;color: #0ec998">As a young developer, I strive to make complex <br>problems, simple. Combined with my passion <br>for entrepreneurship, I hope to create something<br>that can beneficially impact the world.</p>
</div>

4 个答案:

答案 0 :(得分:0)

您可以尝试使用样式标记中的min-width和min-height属性为它们提供最小宽度和高度。确保不使用相对测量单位(如vh,em或rems)使用像素来完全忽略屏幕尺寸。您应该将这些属性放在文本周围的div上。

答案 1 :(得分:0)

只需指定您不想包装CSS的文字即可。白色空间财产。

答案 2 :(得分:0)

white-space属性指定如何处理元素中的空白区域。

空白的序列将合并为一个空白。文本永远不会换行到下一行。文本继续在同一行,直到&lt;遇到了br&gt; 标记。

现在,您可以参考更多文字属性:W3school White-space

p{
  white-space: nowrap;
}
<p>Your desired textYour desired textYour desired textYour desired textYour desired textYour desired textYour desired textYour desired text</p>

答案 3 :(得分:0)

只需将white-space: nowrap;添加到容器中即可。

JSFiddle演示:https://jsfiddle.net/b2dbyjgx/1/

相关问题