gpt4 book ai didi

css - CSS3 中的垂直家谱

转载 作者:行者123 更新时间:2023-11-28 16:10:17 25 4
gpt4 key购买 nike

请找到下面的链接。那是垂直家谱脚本,但我需要水平布局。

<pre>http://jsfiddle.net/mppjmtja/</pre>

这是我的sql脚本

函数显示菜单($parent_id = 0){

$sql=mysql_query("SELECT * FROM menus WHERE parent_id = '$parent_id' ");

if(mysql_num_rows($sql) > 0){


echo "<div class='tree'>";

echo "<ul>";

while ($row = mysql_fetch_array($sql)){

echo "<li> <a href=''> ". $row['menu_name'] ." </a>";
display_menus($row['id']);
echo "</li>";
}

echo "</ul>";
echo "</div>";


}

显示菜单();

最佳答案

现在你可以玩html了,实现你想要的

*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

body {
min-width: 1200px;
margin: 0;
padding: 50px;
color: #000;
font: 16px Verdana, sans-serif;
background: #fff;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

#wrapper {
position: relative;
}

.branch {
position: relative;
margin-left: 250px;
}
.branch:before {
content: "";
width: 50px;
border-top: 2px solid #000;
position: absolute;
left: -100px;
top: 50%;
margin-top: 1px;
}

.entry {
position: relative;
min-height: 60px;
}
.entry:before {
content: "";
height: 100%;
border-left: 2px solid #000;
position: absolute;
left: -50px;
}
.entry:after {
content: "";
width: 50px;
border-top: 2px solid #000;
position: absolute;
left: -50px;
top: 50%;
margin-top: 1px;
}
.entry:first-child:before {
width: 10px;
height: 50%;
top: 50%;
margin-top: 2px;
border-radius: 10px 0 0 0;
}
.entry:first-child:after {
height: 10px;
border-radius: 10px 0 0 0;
}
.entry:last-child:before {
width: 10px;
height: 50%;
border-radius: 0 0 0 10px;
}
.entry:last-child:after {
height: 10px;
border-top: none;
border-bottom: 2px solid #000;
border-radius: 0 0 0 10px;
margin-top: -9px;
}
.entry.sole:before {
display: none;
}
.entry.sole:after {
width: 50px;
height: 0;
margin-top: 1px;
border-radius: 0;
}

.label {
display: block;
min-width: 150px;
padding: 5px 0px;
line-height: 20px;
text-align: center;
position: absolute;
left: 0;
top: 50%;
margin-top: -15px;
}
<div id="wrapper"><span class="label">Root</span>
<div class="branch lv1">
<div class="entry"><span class="label">Entry-1</span>
<div class="branch lv2">
<div class="entry"><span class="label">Entry-1-1</span>
<div class="branch lv3">
<div class="entry sole"><span class="label">Entry-1-1-1</span></div>
</div>
</div>
<div class="entry"><span class="label">Entry-1-2</span>
<div class="branch lv3">
<div class="entry sole"><span class="label">Entry-1-2-1</span></div>
</div>
</div>
<div class="entry"><span class="label">Entry-1-3</span>
<div class="branch lv3">
<div class="entry sole"><span class="label">Entry-1-3-1</span></div>
</div>
</div>
</div>
</div>
<div class="entry"><span class="label">Entry-2</span></div>
<div class="entry"><span class="label">Entry-3</span>
<div class="branch lv2">
<div class="entry"><span class="label">Entry-3-1</span></div>
<div class="entry"><span class="label">Entry-3-2</span></div>
<div class="entry"><span class="label">Entry-3-3</span>
<div class="branch lv3">
<div class="entry"><span class="label">Entry-3-3-1</span></div>
<div class="entry"><span class="label">Entry-3-3-2</span>
<div class="branch lv4">
<div class="entry"><span class="label">Entry-3-3-2-1</span></div>
<div class="entry"><span class="label">Entry-3-3-2-2</span></div>
</div>
</div>
<div class="entry"><span class="label">Entry-3-3-3</span></div>
</div>
</div>
<div class="entry"><span class="label">Entry-3-4</span></div>
</div>
</div>
<div class="entry"><span class="label">Entry-4</span></div>
<div class="entry"><span class="label">Entry-5</span></div>
</div>
</div>

关于css - CSS3 中的垂直家谱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27825413/

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