为什么这个html / css代码没有为考试增加问题之间的空间?

时间:2012-03-05 18:28:20

标签: html css

我正在使用htmlcss来编写考试,我已经创建了一个<div>课程,用于为学生提供写作答案空间的问题。

然而,代码不起作用,我无法弄清楚问题是什么。以下是 - 工作代码的示例。

请帮助我理解为什么这不符合预期。

<html>
  <head>
    <style type="text/css">
       body, pre {
                  font-family: serif;
                  margin-left: 12%;
                  margin-right: 12%;
                  text-align: justify;
                  font-size: 110%;
                 {
       .shortAnsw {
                   padding-bottom: 5cm;
                  }
       .longAnsw  {
                   padding-bottom: 10cm;
                  }
       .answer    {
                   display: none;
                  }
  </style>
</head>

<body>
  <h1>Exam 1</h1>
   <p>
    <strong> Please write your name only on the back of the last page of the exam. </strong> 
   </p>

  <h2>Short Answer</h2>
   <p>
    Please answer the following questions in no more than 3 sentences. 
   </p>
     <ol>
       <li>
         <div class="longAnsw">
           question 1
         </div>
       </li>
       <li>
         <div class="shortAnsw">
           question 2
         </div>
       </li>
       <li>
         <div class="shortAnsw">
          question 3
         </div>
       </li>
      </ol>
   </body>
</html>

2 个答案:

答案 0 :(得分:3)

你有一个向后{

   body, pre {
              font-family: serif;
              margin-left: 12%;
              margin-right: 12%;
              text-align: justify;
              font-size: 110%;
             {

答案 1 :(得分:1)

Divs是容器而不是文本框。如果您想让用户输入文本,您必须使用表单标签。

http://www.w3schools.com/html/html_forms.asp

这是表格的简要教程。