Home > Article > Web Front-end > Dom introductory tutorial diagram recommended_DOM
So how does Dom read and manage Html files? First of all, you must understand the source code structure of html. Look at the picture
If you have ever studied or written Html, then you will understand the above picture clearly. What I want to explain is that the source code structure of Html is hierarchical, and there is also a parent-child or adjacent relationship between tags and tags. It is not difficult to see from the above picture that the HTML tag is the top level. The top one. It can also be understood as the root of the html file. Followed by the Head and Body tags. These two labels are adjacent. It can also be understood as a brotherly relationship. But they all belong to html sub-tags or sub-elements. Then the Body tag contains Table, Div, Div. You can understand these three tags as sub-tags or sub-elements of Body. The Body is the father and they are the son. The same applies to the tags contained in Head. In addition, the first div contains another div. The second div contains some text content. Their relationship is also that of father and son. Dom takes advantage of this relationship structure of Html source code. And cleverly walk freely in your html source code. Like a martial arts master. Use his "Lingbo Weibu" to your heart's content. Look at the code below. The code structure is consistent with the picture above. The difference is that there are a few more buttons to perform some DOM command operations. After running it, you will enter the mysterious and wonderful world of Dom! ! !