0

请帮忙!

这是我到目前为止所拥有的:http: //beauxlent.com/nicole 当您单击“一”、“二”或“三”时,它会将您带到仍在同一页面上的 div。但是,我希望 div 保持在正确的 div 内,并且仍然在使用 #tags 的同一页面上。我以前见过这样做。

<style type="text/css">
 {    
padding: 0;
margin: 0;
}
body {
text-align: justify;
overflow: hidden;
background: #F8F8F8;
font: -blocked- arial;
}
table, p {
display: none;
}
div {
width: 100%;
}

.container {width: 800px; display:block; margin:0px auto}

.left {width:200px; float:left; background: #eee; display:block; height:200px; 
line-        height:2}


.right {width:600px; float:right; background: #808080; display:block; height: 200px; 
line-height:2; }

#o {position:absolute; right: 2000px;}


.blog {
background: 0;
position: absolute;
top: 150px;
left: 500px;
width: 290px;
height: 140px;
}
#omg { 
z-index: 7;
position: absolute;
top: 1000px;
right: 0;
color: #000;
height: 1000px;
}
#plz {

z-index: 7;
position: absolute;
top: 9000px;
right: 0;
color: #000;
height: 9000px;
}

}
#nande a:hover {
color: #000;
}
#nande {

z-index: 7;
position: absolute;
top: 7000px;
right: 0;
color: #000;
height: 1000px;
}
body, table {
color: #fff;
}
font, table, tr, td, br, p {
font: -blocked- franklin gothic medium;
color: #fff;
}
#content {
width: 100%;
    }
#main, #content {
border: 0px none;
background: #fff;
}

}

.framed {
background: #fff;
padding: 5px;

overflow: auto;
position: absolute;
top: 20px;
left: 0px;
}

</style>
<div id="boxed">







<div class="container">





<div class="left">




<a href="#uno" class="big">1</a>

<a href="#dos" class="big">2</a>


<a href="#tres" class="big">3</a>




</div>



<div class="right">


<div id="omg">
<a name="uno"></a>
<div class="framed">
 one
</div>


</div>



<div id="nande">
<a name="dos"></a>
<div class="framed">
 two
</div>
</div>


<div id="plz">
<a name="tres"></a>
<div class="framed">


three
</div>
</div>



</div>
4

2 回答 2

2

你的意思是标签。这也可以在 CSS 中完成。尝试在这里检查 -> http://css-tricks.com/functional-css-tabs-revisited/

HTML 代码:

   <div class="tab">
       <input type="radio" id="tab-1" name="tab-group-1" checked>
       <label for="tab-1">Tab One</label>

       <div class="content">
           stuff
       </div> 
   </div>

   <div class="tab">
       <input type="radio" id="tab-2" name="tab-group-1">
       <label for="tab-2">Tab Two</label>

       <div class="content">
           stuff
       </div> 
   </div>

    <div class="tab">
       <input type="radio" id="tab-3" name="tab-group-1">
       <label for="tab-3">Tab Three</label>

       <div class="content">
           stuff
       </div> 
   </div>

</div>

CSS 代码:

.tabs {
  position: relative;   
  min-height: 200px; /* This part sucks */
  clear: both;
  margin: 25px 0;
}
.tab {
  float: left;
}
.tab label {
  background: #eee; 
  padding: 10px; 
  border: 1px solid #ccc; 
  margin-left: -1px; 
  position: relative;
  left: 1px; 
}
.tab [type=radio] {
  display: none;   
}
.content {
  position: absolute;
  top: 28px;
  left: 0;
  background: white;
  right: 0;
  bottom: 0;
  padding: 20px;
  border: 1px solid #ccc; 
}
[type=radio]:checked ~ label {
  background: white;
  border-bottom: 1px solid white;
  z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
  z-index: 1;
}
于 2012-12-07T02:54:47.023 回答
0

看看jQuery UI Tabs - 很容易实现。

包括

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

jQuery

$(function() {
    $( "#tabs" ).tabs();
});

的HTML

<div id="tabs">
<ul>
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div id="tabs-3">
    <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
    <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
于 2012-12-07T17:57:18.300 回答