当前,当我的div扩展时,边框半径根据div的高度而变化。您会注意到,取决于div的高度,拐角或多或少地被推入/推出。有没有一种方法可以保留边界半径,使其与div的高度无关而保持不变?
我建议将代码段显示为整页或展开!
var toggle = document.getElementById('toggle');
var test = document.getElementById('test');
toggle.onclick = function() {
if (test.style.height == "300px") {
test.style.height = "500px"
} else {
test.style.height = "300px"
}
}
#test {
position: absolute;
z-index: 3;
bottom: 20px;
width: 85%;
height: auto;
margin-left: 3%;
border-radius: 5px / 200px;
line-height: 1.5;
overflow-y: auto;
overflow-x: hidden;
list-style-type: none;
text-align: left;
padding-top: 12px;
padding-left: 5px;
padding-right: 5px;
color: #ffffff;
background-color: green;
min-height: 300px;
}
<div id="test">
</div>
<div id="toggle">toggle
</div>
谢谢!