Chr*_*ore 25 css printing page-break
这是一个典型的多选题考试,假设一个问题格式:
<question qid='1'>
<stem>What is your name?</stem>
<choice value = 'a'>Arthur, King of the Britons</choice>
<choice value = 'b'>There are some who call me ... Tim!</choice>
<choice value = 'c'>He is brave Sir Robin, brave Sir Robin, who-- Shut up! Um, n-- n-- n-- nobody, really. I'm j-- j-- j-- ju-- just, um-- just passing through.</choice>
<choice value = 'd'>Sir Galahad... the Chaste.</choice>
<choice value = 'e'>Zoot... Just Zoot.</choice>
</question>
Run Code Online (Sandbox Code Playgroud)
而且我已经将所有这些都映射到适当的样式与网络的单选按钮.
现在,我需要制作一个可打印的测试版本.这实际上更简单,因为我不需要包括无线电,只需'___'作为复选标记.主要问题是如何防止问题分裂.
Par*_*ots 33
我从来没有幸运地一直阻止这样的事情.它可能有点脏,但如果问题通常是相同的长度,你可以在每X个问题后强制分页吗?
<style type="text/css">
.pageBreak{
page-break-before: always;
}
</style>
<question>...</question><br class="pageBreak" />
<question>...</question>
Run Code Online (Sandbox Code Playgroud)
(或者将该课程应用于问题或任何你想要的)
您可以尝试使用page-break-inside属性,但我还没有看到它是一致的,因为浏览器对它的支持现在很乱:
question {
page-break-inside:avoid;
}
Run Code Online (Sandbox Code Playgroud)