复选框和标签未显示在同一行

Checkbox and label not displaying in same line

我正在使用下面提到的代码动态创建复选框和标签。但是标签和复选框没有在同一行对齐。任何人都可以指导以下代码中的错误吗?

dojo.require("dijit.form.CheckBox");
dojo.ready(function(){    
   var widgetNode = dojo.doc.createElement("DIV");
    chk = dojo.create("input", {id:"cbox", type:"checkbox"}, widgetNode);
    lbl = dojo.create("label", {innerHTML:"Check me", "for":"cbox"}, widgetNode);
    dojo.style(lbl, "marginLeft", ".5em");
var cbWidget = new dijit.form.CheckBox({}, chk);
    cbWidget.startup();
    cbWidget.domNode.appendChild(lbl);
dojo.place(cbWidget.domNode, "container");
});

我通常将复选框放在标签内,而不是使用 for="zzz" 语法。只是容易一点。我认为获得所需内容的最简单方法是包含 dijit theme. Including one of the themes like Claro will automatically have the styles to put the checkbox inline. Example here: http://jsbin.com/fusijoc/1/edit?html,js,output