Home>Article>Web Front-end> How to prevent a tag from jumping in css

How to prevent a tag from jumping in css

醉折花枝作酒筹
醉折花枝作酒筹 Original
2021-05-19 17:25:15 3954browse

Method: 1. Use "//m.sbmmt.com/m/faq/#", the syntax is "a href="//m.sbmmt.com/m/faq/#""; 2. Use "javascript:", the syntax is "a href="javascript:void(0)""; 3. Use getElementById to get the a tag, and use "return false;" to cancel the jump.

How to prevent a tag from jumping in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

百度

1. Let’s do the simplest thing first. We can add the # sign directly to the html code, as follows:

百度 

2. Secondly, we The default event that blocks it is also the following:

百度 

3. There is also our js method to block it. We still give the a tag an id. We only need to do the following Operation:

百度
let div1 = document.getElementById("Header1_HeaderTitle"); div1.onclick = function(){ return false; }

Recommended learning:css video tutorial

The above is the detailed content of How to prevent a tag from jumping in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn