问题描述
我想从另一个页面转到特定页面的DIV。这可能吗?
我试过< a href =file.html#product> Hello< / a> $ c
$ b
但它只是转到 file.html#home
感谢
我在我的file.html文件夹中,重定向到file.html#home。
使用HTML 5,您只需添加 id 属性添加到< div> ,其值 product 。这需要是页面内的唯一 id 属性(对于所有元素):
< div id =product>
请参阅。
在HTML 4.01中,您需要在目标div上方使用<名称的锚标签,或者使用 id $ c $在其他页面中的c>属性:
< a name =product>< / a>
< div> ...
查看HTML 4.01 。
<注意: name 属性在XHTML 1.0规范中。
因此,这将是一个更好的选择,因为它适用于HTML 4.01,XHTML 1.0和HTML 5:
< div id =product>
I would like to go to the DIV of a particular page from a different page. Is that possible?
I tried <a href="file.html#product">Hello</a>
but it just goes to file.html#home
thanks
C.
I have in my file.html but it keeps getting redirected to file.html#home instead.
With HTML 5, you need to simply add an id attribute to your <div> with a value of product. This needs to be a unique id attribute within the page (for all elements):
<div id="product">
See the working draft.
In HTML 4.01 you need to use an anchor tag with a name just above your target div, or any other element with an id attribute in the other page:
<a name="product"></a> <div>...
See the HTML 4.01 spec.
Note: The name attribute has been deprecated in the XHTML 1.0 spec.
So, this would be a better option, as it would work for HTML 4.01, XHTML 1.0 and HTML 5:
<div id="product">
这篇关于转到HTML中另一页的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!