我必须增加单选按钮文本的大小。我在javascript函数中调用了这些单选按钮。
function renderQuestion(){
test = _("test");
if (pos >= questions.length) {
test.innerHTML = "<h2>correct</h2>";
_("test_status").innerHTML = "Quiz 1 Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "<br/> Question " + (pos + 1) + " of " + questions.length;
question = questions[pos][0];
chA = questions[pos][1];
test.innerHTML = "<h3>" + question + "</h3>";
test.innerHTML += "<input type='radio' name='choices' value='A'>" + chA + "<br>";// **need to increase the size of text**
test.innerHTML += "<button onclick='checkAnswer()'>NEXT</button>";
}
答案 0 :(得分:1)
检查这可以是任何帮助。
请替换你的行
test.innerHTML += "<input type='radio' name='choices' value='A'>" + chA + "<br>";
到
test.innerHTML += "<input type='radio' name='choices' value='A'><span style='font-size : 20px;'>" + chA + "</span><br>";
此处style='font-size : 20px;'
可用于增加或减少所需的字体大小
答案 1 :(得分:1)
您应该在复选框中添加标签:
test.innerHTML += '<input type="radio" id="choices" name="choices" value="A"><label for="choices">' + chA + '</label><br>';
您可以在标签中添加一个类,只需通过CSS增加其字体大小。
此外,带有for=""
属性的标签将允许点击标签以选中具有相同ID id="choices"
的复选框。
请注意,我更改了引号。因为在HTML属性上保留默认的"
标记通常更简洁。但这只是个人偏好。