这是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.A{
position: absolute;
left: 0;
width: 100px;
background-color: red;
}
.B{
position: absolute;
left: 100px;
width: 100px;
background-color: blue;
}
</style>
</head>
<body>
<div>
<div class="A" id="A">测试<br>测试<br>测试<br>测试</div>
<div class="B" id="B">测试</div>
</div>
<script>
document.getElementById("B").style.height=document.getElementById("A").style.height;
</script>
</body>
</html>
我希望A和B的高度一样高,但运行后A高、B矮。
我该怎么办?