我只是为我正在电子中制作的游戏客户端编写一个“退出”按钮,在编写该按钮的代码后,它旁边会显示一个巨大的白色条。我还想知道如何使用 translateX(percentage) 将其向上移动到页面的顶部中间,但无法弄清楚。 =
.ExitButton {
color: red;
font-size: 25px;
max-width: 55px;
length: 30px;
border-color: black;
transition-duration: 0.4s;
cursor: pointer;
text-align: center;
}
.ExitButton:hover {
background-color: black;
}
.Exitbutton {
background-color: transparent;
}
<webview src="https://bapbap.gg"></webview>
<button class="ExitButton" onclick="alert('Are you sure you want to exit BapClient?')">Exit</button>
</button>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
我认为发生这种情况是因为您的正文标记具有白色背景颜色,请尝试使用页面的背景颜色更改它,或者您也可以执行以下操作:
.ExitButton { /* ... */ position: absolute; /* make the button 0 pixels away from bottom of the page */ bottom:0; /* you can use top, left or right just like this way to put the button on anywhere on the page you want */ }这本质上将为您的按钮提供绝对位置,并使您能够将其放置在您想要的任何位置。如果与某些元素重叠,请使用
z-index。