gpt4 book ai didi

css 使下拉菜单出现在相邻文本 : please see screenshot 下

转载 作者:行者123 更新时间:2023-11-28 14:28:56 24 4
gpt4 key购买 nike

客户想要这样的东西。我可以管理样式( Angular 落和所有)但我无法将“下拉菜单”放在左侧单元格中的文本下方。我的 html 如下。提前致谢

enter image description here

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('div.outside').hide();

$('div.selector').click(function () {
var hidden = $(this).parents('td').find('div.outside :hidden').length > 0;
$('div.outside').hide();
if (hidden) {
$(this).parents('td').find('div.outside').show().animate('slow');
} else {
$(this).parents('td').find('div.outside').hide().animate('slow');
}
});

});

</script>
<style type="text/css">
ul.action
{
list-style-type: none;
list-style-position: outside;
padding: 0px;
text-align: left;
margin: 0px;
}
ul li
{
margin: 1px 0px 1px 0px;
}
div.content
{
border-style: solid;
border-width: 1px;
padding: 1px;
white-space: nowrap;
overflow: auto;
}

div.outside
{
width: 200px;
position: absolute;
z-index: 100;
}

div.top
{
width: 200px;
}
div.selector
{
cursor: pointer;
padding: 1px 1px 0px 1px;
float: right;
border-style: solid;
border-width: 1px;
border-bottom-style: solid;
top: 2px;
position: relative;
}
.popup-dropdown
{
background-color: #FFFFE1;
}
thead td
{
font-weight: bold;
width: 100px;
}
</style>
<title></title>
</head>
<body>
<table>
<thead>
<tr>
<td>
Name
</td>
<td>
Rank
</td>
<td colspan="2" style="width: 20px;">
Style
</td>
</tr>
</thead>
<tr>
<td>
Jimmi Hendrix
</td>
<td>
1
</td>
<td>
Blues-Rock
</td>
<td style="width: 20px;">
<div class='top'>
<div class='selector popup-dropdown'>
X</div>
</div>
<div style='clear: both;'>
</div>
<div class='outside'>
<div class='content popup-dropdown'>
<ul class='action'>
<li>Make God Status</li>
<li>Elevate</li>
<li>Respect</li>
</ul>
</div>
</div>
</td>
</tr>
<tr>
<td>
Carlos Santana
</td>
<td>
2
</td>
<td>
Blues-Rock
</td>
<td style="width: 20px;">
<div class='top'>
<div class='selector popup-dropdown'>
X</div>
</div>
<div style='clear: both;'>
</div>
<div class='outside'>
<div class='content popup-dropdown'>
<ul class='action'>
<li>Make God Status</li>
<li>Elevate</li>
<li>Respect</li>
</ul>
</div>
</div>
</td>
</tr>
</table>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vulputate pulvinar
nisi vel tincidunt. Mauris eget pulvinar enim. Suspendisse vitae turpis id orci
porttitor auctor nec ut nisi. Nunc euismod. </div>
</body>
</html>

最佳答案

好的。如果我误解了,请纠正我,但我认为您只是想基本上摆脱“X”旁边的空白,并使弹出窗口的右边缘与“X”框的右边缘对齐。您可以使用绝对定位来完成此操作。我在这里对 fiddle 进行了更改:http://jsfiddle.net/F5bn4/2

我更改了 td 上的内联样式,并将 div.top 上的 200px 更改为 20px

关于css 使下拉菜单出现在相邻文本 : please see screenshot 下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7603533/

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