HTML 中的嵌套按钮
Nested buttons in HTML
我试图在 HTML 中的大按钮内显示按钮。
我不明白为什么我的 HTML 代码中的四个内部按钮显示在父按钮之外。
我做错了什么?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Nested Buttons</title>
</script>
</head>
<body >
<button style="height:750px; width:750px">Click here
<button style="height:50px; width:50px">a</button>
<button style="height:50px; width:50px">b</button>
<button style="height:50px; width:50px">c</button>
<button style="height:50px; width:50px">d</button>
</button>
</body>
</html>
您不应在另一个按钮内添加按钮。这是错误的语法。
尝试使用 div
而不是 button
。
<div style="height:750px; width:750px; border:1px solid black;">Click here
<button style="height:50px; width:50px">a</button>
<button style="height:50px; width:50px">b</button>
<button style="height:50px; width:50px">c</button>
<button style="height:50px; width:50px">d</button>
</div>
我试图在 HTML 中的大按钮内显示按钮。
我不明白为什么我的 HTML 代码中的四个内部按钮显示在父按钮之外。
我做错了什么?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Nested Buttons</title>
</script>
</head>
<body >
<button style="height:750px; width:750px">Click here
<button style="height:50px; width:50px">a</button>
<button style="height:50px; width:50px">b</button>
<button style="height:50px; width:50px">c</button>
<button style="height:50px; width:50px">d</button>
</button>
</body>
</html>
您不应在另一个按钮内添加按钮。这是错误的语法。
尝试使用 div
而不是 button
。
<div style="height:750px; width:750px; border:1px solid black;">Click here
<button style="height:50px; width:50px">a</button>
<button style="height:50px; width:50px">b</button>
<button style="height:50px; width:50px">c</button>
<button style="height:50px; width:50px">d</button>
</div>