我怎样才能强制文字或div只有这么宽
我让用户在一个文本区域中输入信息,该文本区域已设置为 runat-“server”,一页宽度为 600 像素。当他们单击按钮时,内容应该显示在第二页上。我尝试将它们显示为 aliteral 和 div。但在这两种情况下,即使我将控件放在表格中并将表格和列的宽度设置为 600px,如果我在第一页的文本区域中放置 1000 个字符,那么在第二页上,显示控件将远远宽于我想将其限制为 600 像素。我怎样才能强制一个控件只有这么宽。 PS>.它必须是文字或 div,因为我正在尝试在其中呈现 HTML。
I have users enter info into a textarea that's been set to runat-"server" and that is 600px wide on 1 page. When they click a button the contents are supposed to show on the second page. I've tried displaying them as both aliteral and div. But in both cases, even if I put controls in a table and set the width of the table and columns to 600px, if I put, say 1000 characters in the textarea on page one, on page 2 the display control is far wider than the 600 pixels I want to limit it to. How can I force a control to only be so wide. PS>. It has to be a literal or div because i am trying to render HTML in them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在您的输出页面上尝试这种样式。我设置了overflow:hidden,这样如果您输入一个没有空格的非常长的单词,它会隐藏无法换行的多余文本,而不是扩展框的宽度。
CSS:
HTML:
Perhaps try this style on your output page. I set
overflow:hidden
so that if you enter a really long word with no whitespace, it'll hide the excess text that can't be wrapped rather than extending the width of the box.CSS:
HTML: