Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何单击链接,然后滚动并显示div_Html_Css - Fatal编程技术网

Html 如何单击链接,然后滚动并显示div

Html 如何单击链接,然后滚动并显示div,html,css,Html,Css,我有三个头衔,像这样: <a href="#">title 1</a> <a href="#">title 2</a> <a href="#">title 3</a> <div id="one">there is a describe for title 1</div> <div id="two">there is a describe for title 2</div> &

我有三个头衔,像这样:

<a href="#">title 1</a>
<a href="#">title 2</a>
<a href="#">title 3</a>
<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>

我有3个div来解释它们,如下所示:

<a href="#">title 1</a>
<a href="#">title 2</a>
<a href="#">title 3</a>
<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>
标题1有一个描述
标题2有一个描述
标题3有一个描述
要点:每个描述都是多行的(本页有overflow-y:scrool,本页高度太长)

现在我想当用户单击标题1时,页面滚动并显示其他标题的
,依此类推

要点:通过HTML或CSS或两者,而不是JS,我使用:

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


而且工作正常

你试过了吗?@rsilva我试过了,工作正常