gpt4 book ai didi

html - 在自定义警报框内的文本之后对齐中心的按钮

转载 作者:太空宇宙 更新时间:2023-11-03 18:35:23 25 4
gpt4 key购买 nike

我需要你的帮助。

如何调整 HTML/CSS 属性以允许“确定”按钮出现在我的自定义提示框的中心和文本之后?

我不能,我一辈子都不知道该怎么做。 =\

事情是这样的: enter image description here

这是我想要的结果: enter image description here

这是 html 标记:

<!DOCTYPE html>

<html>

<head>

<style type="text/css">
/*--------------------------------------------------------------------------------------------------
CUSTOM ALERT BOX
--------------------------------------------------------------------------------------------------*/
#alertBox {
height: 100px;
width: 500px;
bottom: 50%;
right: 50%;
position: absolute;
font-family: tahoma;
font-size: 8pt;
visibility: hidden;
}

#alertBox_container {
background: rgb(212,208,200);
left: 50%;
padding: 10px;
top: 50%;
margin: 0;
padding: 0;
height: 100%;
border: 1px solid rgb(128,128,128);
height: 100%;
position: relative;
}

#alertBox_titlebar {
height: 22px;
width: 100%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#0A246A, endColorStr=#A6CAF0, GradientType=1);
color: white;
line-height:22px;
font-weight: bold;
}

#alertBox_close {
line-height: 10px;
width: 18px;
font-size: 10px;
font-family: tahoma;
margin-top: 1px;
margin-right: 2px;
position:absolute;
top:0;
right:0;
font-weight: bold;
}
#alertBox_text {
position: absolute;
width: 100%;
height: auto;
top: 50%;
text-align: center;
}
#alertBox_btn{
position: relative;
width: 40px;
height: auto;
text-align: center;
}
</style>

<script type="text/javascript">
//alertBox('text','ok')
function alertBox(text) {

document.getElementById('alertBox_text').innerHTML = text

document.getElementById('alertBox').style.visibility = 'visible'

}

function alertBox_hide() {

document.getElementById('alertBox').style.visibility = 'hidden'

}
</script>

</head>

<body onload="alertBox('this is a test')">
<div id="alertBox">
<div id="alertBox_container">
<div id="alertBox_titlebar"><span style="padding-left: 3px;">IMTS</span></div>
<div><input id="alertBox_close" type="button" value="X" onclick="alertBox_hide()"></div>
<div id="alertBox_text">This is some sample text that will appear here</div>
<div id="alertBox_btn"><input type="button" value="OK"></div>
</div>
</div>
</div>
</body>

</html>

最佳答案

改变类(class)..

<style type="text/css">
#alertBox {
height: 100px;
width: 500px;
bottom: 50%;
right: 50%;
position: absolute;
font-family: tahoma;
font-size: 8pt;
visibility: hidden;
}

#alertBox_container {
background: rgb(212,208,200);
left: 50%;
padding: 10px;
top: 50%;
margin: 0;
padding: 0;
height: 100%;
border: 1px solid rgb(128,128,128);
height: 100%;
position: relative;
}

#alertBox_titlebar {
height: 22px;
width: 100%;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#0A246A, endColorStr=#A6CAF0, GradientType=1);
color: white;
line-height:22px;
font-weight: bold;
}

#alertBox_close {
line-height: 10px;
width: 18px;
font-size: 10px;
font-family: tahoma;
margin-top: 1px;
margin-right: 2px;
position:absolute;
top:0;
right:0;
font-weight: bold;
}
#alertBox_text {
width: 100%;
height: auto;
text-align: center;
margin-top:27px;`
}
#alertBox_btn{
position: relative;
height: auto;
text-align: center;
}
</style>

关于html - 在自定义警报框内的文本之后对齐中心的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18836260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com