gpt4 book ai didi

jquery - 类按钮
的 css 样式

转载 作者:太空宇宙 更新时间:2023-11-04 13:45:48 24 4
gpt4 key购买 nike

我正在尝试在我的元素中添加以模拟弹出窗口(稍后我将从我的应用程序的其他页面添加内容)。我有以下代码:

html

<div id="box">
<div id="title">Titulo <span id="button">X</span> </div>
<div id="text">Conteudo</div>
</div>

javascript/jquery

$('window').load(function(){
$('#box').draggable();
});

CSS

#box {
box-sizing: padding-box;
box-shadow: 10px 5px 5px black;
border-style: solid;
position: absolute;
width: 320px;
height: 640px;
min-width: 160px;
min-height: 500px;
max-width: 500px;
max-height: 750px;
top: 200px;
left: 200px;
}

#button {
background-color: red;
padding: 0px 0px 0px 95%;
min-width: 32px;
max-width: 5%;
position:absolute;
}

#title {
background-color: black;
text-decoration-color: white;
font: 32px/36px arial;
position: relative;
}

#text {
background-color: white;
text-decoration-color: black;
font: 24px/28px sans-serif;
position: relative;
}

底线:我希望由 id=button 标识的元素位于“窗口”标题栏的右上角,但在当前状态下,这就是我得到的:

我如何改进它以实现我想要的?

ps.: 我接受使用 jquery/jquery-ui 的建议。我尝试了较早的 BootstrapDialog,但没有为我的元素服务,因为它没有根据加载的内容调整自身并在页面打开时阻止其他内容。

最佳答案

我想我得到了你想要的。填充有点多,所以我将其删除。另外,如果你希望它在绝对位置时右对齐,你只需要 right:0px;另一件事是 'X' 在 div 中没有居中对齐所以我添加了 text-align:center;将您的#button css 样式更改为以下内容:

    #button {
background-color: red;
min-width: 32px;
max-width: 5%;
position:absolute;
right:0px;
text-align:center;
padding-left:10px;
padding-right:10px;
}

关于jquery - 类按钮 <div> 的 css 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22520566/

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