js实现html dom 标签解析器选择器效果代码

代码语言:html

所属分类:其他

代码描述:js实现html标签解析器选择器效果代码,可解析html中dom元素的id、class tag标签及内容及属性值。

代码标签: js html dom 标签 解析器 选择器

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
<style>
html {
  font-size: 1vw;
}

body {
  display: flex;
  flex-direction: column;
  background-color: #333;
  font-family: monospace;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}

.buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.button-group {
  margin: 0.5rem 0;
}

button {
  font-size: 2rem;
  padding: 0.5rem 1rem;
  margin: 0;
  border: none;
  outline: none;
  border-radius: 2rem;
}
button:hover {
  background: #1f1f1f;
  color: #fff;
}

.entity {
  margin-bottom: 5rem;
}

pre {
  color: #eee;
  font-size: 3rem;
  tab-size: 3;
}

.selected {
  background: white;
  border-radius: 1rem;
  color: black;
}
.selected * {
  color: black;
}
</style>


  
  
</head>

<body translate="no">

<div class="entity">
	<pre>
<span class="tag tag-name start-tag">&lt;<span class="tag-name">button</span> <span class="attribute"><span class="attribute-name">id</span>=<span class="attribute-value">&ldquo;login-btn&rdquo;</span></span> <span class="attribute"><span class="attribute-name">class</span>=<span class="attribute-value">&ldquo;primary&rdquo;</span></span>&gt;</span>
	<span class="tag content">Click Here</span>
<span class="tag tag-name end-tag">&lt;/<span class="tag-name">button</span>&gt;</span>
	</pre>
</div>


<div class="buttons">
	<div class="button-group">
		<button id="tag-btn" title="Refers to the element tags and any children elements or textua.........完整代码请登录后点击上方下载按钮下载查看

网友评论0