javascript - 如何在一个手机页面中放置适量的字符(页面和字体大小在不同的手机上会有所不同)

标签 javascript html css cordova

我要问的这个问题很难表达,所以如果你认为我的表达没有反射(reflect)我想问的问题,请指正我,在此先感谢。

我正在开发电子书移动应用程序。我需要考虑的事情是: 1.屏幕尺寸 2.字体大小 3. 根据当前屏幕大小和字体大小,一页应该放多少段。

我想在更大的屏幕上使用更大的字体,所以我不知道如何决定一页应该放多少段落。 我拥有整篇文章的数据,但不知道何时何地将其分成几页。

欢迎提出任何建议或想法。

更新:

好吧,让我更详细一点。

假设我有一篇文章:

var arti = "Stack Overflow is a website, the flagship site of the Stack Exchange Network,[2][3] created in 2008 by Jeff Atwood and Joel Spolsky,[4][5] as a more open alternative to earlier Q&A sites such as Experts Exchange. The name for the website was chosen by voting in April 2008 by readers of Coding Horror, Atwood's popular programming blog.[6]
It features questions and answers on a wide range of topics in computer programming.[7][8][9] The website serves as a platform for users to ask and answer questions, and, through membership and active participation, to vote questions and answers up or down and edit questions and answers in a fashion similar to a wiki or digg.[10] Users of Stack Overflow can earn reputation points and "badges"; for example, a person is awarded 10 reputation points for receiving an "up" vote on an answer given to a question, and can receive badges for their valued contributions,[11] which represents a kind of gamification of the traditional Q&A site or forum. All user-generated content is licensed under a Creative Commons Attribute-ShareAlike license.[12]
As of August 2013, Stack Overflow has over 1,900,000 registered users and more than 5,500,000 questions.[13][14] Based on the type of tags assigned to questions, the top eight most discussed topics on the site are: C#, Java, PHP, JavaScript, Android, jQuery, C++ and Python.[15]";

我用来测试我的应用程序的手机屏幕尺寸是 1280*760,在一个屏幕上只能显示大约 X 个字符。

所以我的程序应该在第 X、2*X、3*X 等字符的末尾中断 arti 的内容。

所以问题是 我不知道如何计算 X。

最佳答案

我建议较小的屏幕使用较大的字符!

关于javascript - 如何在一个手机页面中放置适量的字符(页面和字体大小在不同的手机上会有所不同),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20870031/

相关文章:

html - CSS:calc() 不遵守 Firefox 和 IE 中的底部填充

html - 打印 - chrome 中缺少页眉和页脚 + 未对齐的自定义页脚

css - 通过单击填充来定位 ahref

javascript - 添加到 Chrome 扩展中的 innerHTML 的内容被修改

javascript - 在新窗口中打印 HTML 代码的 DOM 树

jquery - 淡出 div 背景会影响背景图像顶部的其他 div

html - 更改后端 html wordpress

javascript - setState 没有设置状态变量 React

javascript - 动态文本区域内单词的字符限制

html - 菜单下拉列表太长