如何在模板中添加锚点到django url [英] how to add anchor to django url in template
本文介绍了如何在模板中添加锚点到django url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<一个数据悬停=你有风险吗? href ={%url'home'%}#container>我的链接< / a>
这不行。
点击此链接可以让它移动到锚点吗?
解决方案
确保实际的锚点被定义如下在您的模板中:
< a name =container>< / a>
然后按照您所做的方式链接到它:
< a data-hover =你有风险吗? href ={%url'home'%}#container>我的链接< / a>
如果这不起作用添加 /
之前的#
-tag:
< a data-hover = 你有风险吗? href ={%url'home'%} /#container>我的链接< / a>
I am trying to add an anchor to my url in a django template like this:
<a data-hover="Are You At Risk?" href="{% url 'home' %}#container">My link</a>
This does not work.
How can I get this to move to the anchor point when this link is clicked?
解决方案
Make sure the actual anchor is defined like this in your template:
<a name="container"></a>
And then link to it the way you did:
<a data-hover="Are You At Risk?" href="{% url 'home' %}#container">My link</a>
If this does not work add /
just before your #
-tag:
<a data-hover="Are You At Risk?" href="{% url 'home' %}/#container">My link</a>
这篇关于如何在模板中添加锚点到django url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文