Javascript 复选框标签显示在下一行

Javascript 复选框标签显示在下一行,javascript,checkbox,Javascript,Checkbox,我有一个复选框列表,我创建了一个javascript函数,它将复选框添加到复选框列表中, 这是密码 function add1() { var ques = document.getElementById('Questions_que1'); var container = document.getElementById('Questions_wh1'); var checkbox = document.createElement('input'); checkbox.type

我有一个复选框列表,我创建了一个javascript函数,它将复选框添加到复选框列表中, 这是密码

function add1()
{
  var ques = document.getElementById('Questions_que1');
  var container = document.getElementById('Questions_wh1');
  var checkbox = document.createElement('input');

  checkbox.type = "checkbox";
  checkbox.name = "que1";
  checkbox.value = ques.value;
  checkbox.id = "id";

  var label = document.createElement('label');

  label.htmlFor = "id";

  label.appendChild(document.createTextNode(ques.value));

  container.appendChild(checkbox);
  container.appendChild(label);   
}
但问题是复选框标签显示在下一行,而不是在同一行的复选框之后


我在这里写什么?

尝试添加checkbox.style.display=“inline”。您可以检查checkbox元素是否应用了“display:block”样式。我尝试了display=“inline”,我可以在源代码中看到display:inline。但仍然没有效果,它仍然在复选框下方…我认为这是因为最后两条语句…容器的宽度是多少?