如何点击链接然后滚动并显示div

时间:2015-04-21 15:54:04

标签: html css

我有3个标题,如下:

<a href="#">title 1</a>
<a href="#">title 2</a>
<a href="#">title 3</a>

我有3个div来解释它们,就像这样:

<div id="one">there is a describe for title 1</div>
<div id="two">there is a describe for title 2</div>
<div id="three">there is a describe for title 3</div>

点:每个描述都是多行的(此页面有溢出-y:scrool,此页面的高度太长)

现在我想要当用户点击标题1,页面滚动并显示<div id="one">,依此类推其他标题。

点:通过HTML或CSS或两者,NOT JS

1 个答案:

答案 0 :(得分:0)

我用过:

<a href="#one">title 1</a>

并正常工作......!