標題與內容連接中間不顯示邊框佈局

標題與內容連接中間不顯示邊框佈局:


1.給最外層div加個寬度,包住標題和內容;

2.標題用ul,li:給ul加下邊框2px,高度30px,行高30px;給li加高度28px,行高28px;給選中li加上邊框2px,下邊框2px白色;

<!DOCTYPE html>

<html>


<head>
<meta charset="UTF-8">
<title></title>
<style>
.box{
width: 430px;
}
.clearfloat:after {
display: block;
clear: both;
content: "";
visibility: hidden;
height: 0;
}

.clearfloat {
zoom: 1
}

ul,
li {
list-style: none;
padding: 0;
margin: 0;
}

.title {
border-bottom: 2px solid red;
height: 30px;
line-height: 30px;
}

.title li {
float: left;
width: 70px;
margin: 0 3px;
cursor: pointer;
border: 1px solid #ddd;
text-align: center;
line-height: 28px;
height: 28px;
border-bottom: 0;
}
.title li.active{
border-top: 2px solid red;
border-bottom: 2px solid #fff;
}
.content{
border: 1px solid blue;
padding-left: 20px;
padding-bottom: 30px;
border-top: none;
}
.content a{
color: #333;
text-decoration: none;
line-height: 24px;
margin-bottom: 5px;
display: block;
}
.hide{
display: none;
}
</style>
<script>
window.onload=function(){
var title=document.getElementById("title");
var Oli=title.getElementsByTagName("li");

var content=document.getElementById("content");
var Oul=content.getElementsByTagName("ul");

for(var i=0;i<Oli.length;i++){
Oli[i].index=i;
Oli[i].onmouseover=function(){
for(var i=0;i<Oli.length;i++){
Oli[i].className=" ";
}
this.className="active";

for(var j=0;j<Oul.length;j++){
Oul[j].className="hide";
}
Oul[this.index].className=" ";
}
}
}

</script>
</head>


<body>
<div class="box">
<ul id="title" class="title clearfloat">
<li class="active">房產</li>
<li>家居</li>
<li>二手房</li>
</ul>
<div id="content" class="content">
<ul>
<li>
<a href="#">275萬購昌平鄰鐵三居 總價20萬買一居</a>
</li>
<li>
<a href="#">200萬內購五環三居 140萬安家東三環</a>
</li>
<li>
<a href="#">北京首現零首付樓盤 53萬購東5環50平</a>
</li>
<li>
<a href="#">京樓盤直降5000 中信府 公園樓王現房</a>
</li>
</ul>
<ul class="hide">
<li>
<a href="#">40平出租屋大改造 美少女的混搭小窩</a>
</li>
<li>
<a href="#">經典清新簡歐愛家 90平老房煥發新生</a>
</li>
<li>
<a href="#">新中式的酷色溫情 66平撞色活潑家居</a>
</li>
<li>
<a href="#">瓷磚就像選好老婆 衛生間煙道的設計</a>
</li>
</ul>
<ul class="hide">
<li>
<a href="#">通州豪華3居260萬 二環稀缺2居250w甩</a>
</li>
<li>
<a href="#">西3環通透2居290萬 130萬2居限量搶購</a>
</li>
<li>
<a href="#">黃城根小學學區僅260萬 121平70萬拋!</a>
</li>
<li>
<a href="#">獨家別墅280萬 蘇州橋2居優惠價248萬</a>
</li>
</ul>
</div>
</div>

</body>


</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章