首先道歉,我仍然是一个菜鸟而不是程序员,只是一个自学成才的 html-designer(或多或少)并且坚持了一个问题,我为此搜索了近几周的解决方案。
我正在构建一个词汇表,并在左侧有一个带有条目的可滚动列,每个条目都有一个<a href=index.html#302>blah </a>
指向主窗口的链接,其中包含相同的单词和解释。主窗口由父母和孩子组成。孩子只是稍微宽了一点,104%,以隐藏 y 滚动条。每个条目都是一个完全设计的 div 元素,margin-bottom:300em;
当单击左侧窗口中带有单词的条目时,它会给出弹出窗口的外观。
令我困扰的是,我无法<div class=ov id=203>
通过index.html#203
输入 url 来跳转到一个单词,也无法使用 alt-arrow-left回到历史记录(我只看到顶部 url 中的 # 数字发生了变化,但页面仍然存在相同)。不过,左栏中的链接可以正常工作。当我剥离所有周围的窗口并使其成为一个没有嵌套 div 的裸 html 页面时,它也可以正常工作。谁能解释为什么会这样以及我可以做些什么才能通过在网址中输入#-number 来跳转到#?我尝试使用文本向 div-child 添加几种定位样式,但无济于事。
非常感谢!
示例:左侧可滚动列
<div class=trefw>
<a class=w href=#1>xxxxx </a>
<a class=w href=#2>ccccc </a>
<a class=w href=#3>dfasdfasd </a>
<a class=w href=#4>sdfzdfasdf </a>
</div>
正文
<div class=context>
<div class=context1>
<div class=ov id=1><p3>xxxx</p3>xxxx</div>
<div class=ov id=2><p3>cccc</p3>cccccc</div>
<div class=ov id=3><p3>dfasdfasd </p3>dfasdfasd </div>
<div class=ov id=4><p3>sdfzdfasdf </p3>sdfzdfasdf </div>
</div></div>
CSS:
.trefw {
position:fixed;
top: 60px;
left: 0px;
bottom: 0px;
width: 200px;
height:auto;
overflow-y:auto;
overflow-x:hidden;
z-index:499;
}
.context {
position:fixed;
top: 180px;
width:auto;
height:auto;
left: 210px;
right: 100px;
bottom: 30px;
overflow:hidden;
z-index:70;
}
.context1 {
position:relative;
width:104.5%;
height:100%;
overflow-y:scroll;
}
.ov {
font-family:basr;
text-align:left;
margin:20px;
height:auto;
margin-bottom:300em;
width:80%;
padding:28px;
border-radius:22px;
background-color:#fff;
-webkit-box-shadow: 9px 9px 15px 0px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 9px 9px 15px 0px rgba(0, 0, 0, 0.5);
box-shadow: 9px 9px 15px 0px rgba(0, 0, 0, 0.5);
}