javascript - 如何在 HTML 中自动换行?
问题描述
我有一段像下面这样的文本,为了查看整个
文本,我需要滚动到最后。
Hello, this is a piece of text and it is going beyond the screen width and I need scroll to view the whole piece of text which is not so comfortable....
我希望它在屏幕宽度结束时自动换行,例如我想在手机上自动显示如下示例
Hello, this is a piece of text
and it is going beyond the screen
width and I need scroll
to view the whole piece of text
which is not so comfortable....
知道怎么做吗?
解决方案
您应该阅读HTML 响应式网页设计。
响应式网页设计是关于使用 HTML 和 CSS 自动调整网站大小、隐藏、缩小或放大网站,使其在所有设备(台式机、平板电脑和手机)上看起来都不错
下面是我们如何在 CSS 中创建媒体查询。仅当屏幕宽度小于 768 像素时才会应用此 CSS 块。
@media (max-width: 768px) {
.container {
width: 100%
}
}
推荐阅读
- python - 语句必须用换行符或分号分隔
- python-3.x - 发生错误时如何使程序进一步工作?
- javascript - EJS 不在脚本之间呈现 HTML
- php - 为什么 Netbeans 不再占用我的项目文件夹?
- javascript - 我可以在 JS 中仅使用异步返回已解决的承诺吗?
- javascript - 转到不同页面时停止音频
- html - 如何在我的内容下为 Adsense 横幅移动创建 CSS
- python - 标记字符,除非用括号封装并保留括号
- javascript - HTML - 在 html 表格中设置图像和文本的正确对齐方式
- html - Angular - 我可以限制页面上动态创建的卡片的数量吗?