html - <div> 元素 : How can i get my div text to be as it is while resizing

标签 html css

我创建了这个 JSfiddle对于我的问题。

在这个特殊的 fiddle 中,当我们调整窗口大小时,div 元素会相应地改变自己。但我希望那不会发生。使用 {white-space: nowrap;} 似乎不是一个好的选择。小帮助将不胜感激。谢谢。

<body>
  <p>This is a paragraph with no specified margins. i am writing stuffs to just make things long so as to provide a better understanding of my question.</p>
  <p class="margin">This is a paragraph with specified margins. i am writing stuffs to just make things long so as to provide a better understanding of my question. Press the "restore down" button present before "close button" or resize the window. It will change it shape according to CSS. I want that not happen. it should appear as it is while restoring or resizing.</p>
  <p align="center"> In short i want a responsive "div" elements. </p>
</body>

我需要固定 div 元素,它们在调整大小时不应该改变自己。谢谢。

最佳答案

设置body width fix来解决这个问题,

body{
    margin-left: auto;
    margin-right: auto;
    width:400px;
}

检查这个 demo jsFiddle

关于html - <div> 元素 : How can i get my div text to be as it is while resizing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23284248/

相关文章:

html - 如何自动调整中间div宽度?

html - 如果我包含 Nav 标签,Chrome 屏幕上不会显示任何其他内容

css - 如何解决 Firefox 2.0 跨浏览器问题?

css - Safari 在悬停时加粗浅色@font-face 字体

html - 定位在模态窗口外时图像被截断

html - 当我调整窗口大小时,我们如何防止图像使用 HTML-CSS 移动?

html - Zalgo 文本如何工作?

javascript - 如何为中心容器中的最后一个元素设置左对齐?

javascript - 更改 iframe src 会阻止父级隐藏

javascript - 返回 false 时表单仍然提交(看不到错误)