我有一個頁面,顯示一個長篇文章,以獲得舒適的閱讀。我想在寬屏幕上將文本分成多列,但我不想讓用戶一直滾動到頁面底部,然後在完成每列後重新回到頂部。我可以自動將CSS列分成垂直適合視口的'頁面'嗎?
有沒有一種方法可以在不使用JavaScript的情況下自動將文章分割爲足夠短的垂直部分('頁面'),以便完全適合視口?下面是一些ASCII藝術來說明:
+-------------------------------------------------------------+
| === Some Title === |
| |
| You think water moves fast? it out. Now we took an oath, |
| You should see ice. It moves that I'm breaking now. We |
| like it has a mind. Like it said we'd say it was the |
| knows it killed the world snow that killed the other |
| once and got a taste for two, but it wasn't. Nature |
| murder. After the avalanche, is lethal but it doesn't |
| it took us a week to climb hold a candle to man. |
| out. Now, I don't know |
| exactly when we turned on Like you, I used to think |
| each other, but I know that the world was this great |
| seven of us survived the place where everybody lived |
| slide... and only five made by the same standards I did, |
+-------------------------------------------------------------+
| then some kid with a nail Dr. Wu inserted a gene that |
| showed me I was living in makes a single faulty enzyme |
| his world, a world where in protein metabolism. The |
| chaos rules not order, a animals can't manufacture the |
| world where righteousness is amino acid lysine. Unless |
| not rewarded. That's Cesar's they're continually supplied |
| world, and if you're not with lysine by us, they'll |
| willing to play by his rules, slip into a coma and die. |
| then you're gonna have to pay |
| the price. Do you see any Teletubbies in |
| The lysine contingency - here? Do you see a slender |
| it's intended to prevent the plastic tag clipped to my |
| spread of the animals is case shirt with my name printed on |
| they ever got off the island. it? |
+-------------------------------------------------------------+
的線代表視口的高度。列在視口底部結束,文本將流到下一列的頂部,該列從視口頂部開始。一旦讀取了文本的「頁面」,用戶就會向下滾動到下一頁,然後重新開始。這允許將文本拆分成列而不需要大量額外的滾動。在大屏幕上,「頁面」會很高,但在小屏幕上,它們將足夠短以適合視口。
一個好的解決方案不一定要完美的語義,但不應該需要任何JavaScript。
我瞭解CSS列模塊;我想知道的是如何打破列,以便它們垂直放置在視口中。你能指出我如何做到這一點? – Nathan
我認爲你最好的選擇就是做一個有根據的猜測......每1000個單詞或者其他任何東西就叫它。低估。然後在頁面之間放置一個很好的中斷,並且如果頁面不在視口的底部,也可以。使用Javascript可能是完成此操作的唯一方法 –
使用某些顯示錶格,高度:100%,列寬爲50%;你應該能夠處理,不是嗎?或者也許:身高:100vh; (vh單位根據視口高度)http://snook.ca/archives/html_and_css/vm-vh-units – dievardump