HTML元素周期表

简介: HTML元素周期表


写在前面

本期小编给大家推荐一个炫酷的元素周期表o(* ̄▽ ̄*)ブ。

元素周期表

元素周期表是化学中最重要的工具之一,它是一种将化学元素按照原子序数排列并且以相似性分组的表格。由俄罗斯化学家门捷列夫于1869年首次提出,并在之后经过多次修订和完善。周期表的基本结构是由水平排列的周期和垂直排列的族组成。

元素周期表按照原子序数的增加,从左至右和从上至下地排列化学元素。这种排列方式使得具有相似化学性质的元素出现在同一列,形成了周期性的重复性质。周期表中的每一个水平行称为一个周期,而每一个垂直列则称为一个族。


周期表不仅仅是一种分类工具,更是一种重要的预测性工具。它可以帮助化学家理解元素之间的关系,推断元素的性质和行为。周期表的结构反映了原子结构的规律,例如,原子半径、电负性、电离能、原子量等随周期和族的变化呈现出一定的规律性。


元素周期表的发展推动了化学科学的发展,深化了对元素性质和反应规律的理解,促进了新材料的发现和应用。它不仅在化学领域中有着广泛的应用,还在物理学、地球科学等领域中有着重要的作用。总的来说,元素周期表是化学领域中不可或缺的工具之一,对于理解和应用化学知识具有重要意义。


完整代码

<!DOCTYPE html>
<html>
 
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <title>periodic table of elements</title>
  <style>
    html,
    body {
      height: 100%;
    }
 
    body {
      background-color: #000000;
      margin: 0;
      font-family: Helvetica, sans-serif;
      ;
      overflow: hidden;
    }
 
    a {
      color: #ffffff;
    }
 
    #info {
      position: absolute;
      width: 100%;
      color: #ffffff;
      padding: 5px;
      font-family: Monospace;
      font-size: 13px;
      font-weight: bold;
      text-align: center;
      z-index: 1;
    }
 
    #menu {
      position: absolute;
      bottom: 20px;
      width: 100%;
      text-align: center;
    }
 
    .element {
      width: 120px;
      height: 160px;
      box-shadow: 0px 0px 12px rgba(0, 255, 255, 0.5);
      border: 1px solid rgba(127, 255, 255, 0.25);
      text-align: center;
      cursor: default;
    }
 
    .element:hover {
      box-shadow: 0px 0px 12px rgba(0, 255, 255, 0.75);
      border: 1px solid rgba(127, 255, 255, 0.75);
    }
 
    .element .number {
      position: absolute;
      top: 20px;
      right: 20px;
      font-size: 12px;
      color: rgba(127, 255, 255, 0.75);
    }
 
    .element .symbol {
      position: absolute;
      top: 40px;
      left: 0px;
      right: 0px;
      font-size: 60px;
      font-weight: bold;
      color: rgba(255, 255, 255, 0.75);
      text-shadow: 0 0 10px rgba(0, 255, 255, 0.95);
    }
 
    .element .details {
      position: absolute;
      bottom: 15px;
      left: 0px;
      right: 0px;
      font-size: 12px;
      color: rgba(127, 255, 255, 0.75);
    }
 
    button {
      color: rgba(127, 255, 255, 0.75);
      background: transparent;
      outline: 1px solid rgba(127, 255, 255, 0.75);
      border: 0px;
      padding: 5px 10px;
      cursor: pointer;
    }
 
    button:hover {
      background-color: rgba(0, 255, 255, 0.5);
    }
 
    button:active {
      color: #000000;
      background-color: rgba(0, 255, 255, 0.75);
    }
</style>
</head>
 
<body>
  <script src="js/three.min.js"></script>
  <script src="js/tween.min.js"></script>
  <script src="js/TrackballControls.js"></script>
  <script src="js/CSS3DRenderer.js"></script>
  <div id="container"></div>
  <div id="menu">
    <button id="table">TABLE</button>
    <button id="sphere">SPHERE</button>
    <button id="helix">HELIX</button>
    <button id="grid">GRID</button>
  </div>
  <script>
    var table = [
      "H", "Hydrogen", "1.00794", 1, 1,
      "He", "Helium", "4.002602", 18, 1,
      "Li", "Lithium", "6.941", 1, 2,
      "Be", "Beryllium", "9.012182", 2, 2,
      "B", "Boron", "10.811", 13, 2,
      "C", "Carbon", "12.0107", 14, 2,
      "N", "Nitrogen", "14.0067", 15, 2,
      "O", "Oxygen", "15.9994", 16, 2,
      "F", "Fluorine", "18.9984032", 17, 2,
      "Ne", "Neon", "20.1797", 18, 2,
      "Na", "Sodium", "22.98976...", 1, 3,
      "Mg", "Magnesium", "24.305", 2, 3,
      "Al", "Aluminium", "26.9815386", 13, 3,
      "Si", "Silicon", "28.0855", 14, 3,
      "P", "Phosphorus", "30.973762", 15, 3,
      "S", "Sulfur", "32.065", 16, 3,
      "Cl", "Chlorine", "35.453", 17, 3,
      "Ar", "Argon", "39.948", 18, 3,
      "K", "Potassium", "39.948", 1, 4,
      "Ca", "Calcium", "40.078", 2, 4,
      "Sc", "Scandium", "44.955912", 3, 4,
      "Ti", "Titanium", "47.867", 4, 4,
      "V", "Vanadium", "50.9415", 5, 4,
      "Cr", "Chromium", "51.9961", 6, 4,
      "Mn", "Manganese", "54.938045", 7, 4,
      "Fe", "Iron", "55.845", 8, 4,
      "Co", "Cobalt", "58.933195", 9, 4,
      "Ni", "Nickel", "58.6934", 10, 4,
      "Cu", "Copper", "63.546", 11, 4,
      "Zn", "Zinc", "65.38", 12, 4,
      "Ga", "Gallium", "69.723", 13, 4,
      "Ge", "Germanium", "72.63", 14, 4,
      "As", "Arsenic", "74.9216", 15, 4,
      "Se", "Selenium", "78.96", 16, 4,
      "Br", "Bromine", "79.904", 17, 4,
      "Kr", "Krypton", "83.798", 18, 4,
      "Rb", "Rubidium", "85.4678", 1, 5,
      "Sr", "Strontium", "87.62", 2, 5,
      "Y", "Yttrium", "88.90585", 3, 5,
      "Zr", "Zirconium", "91.224", 4, 5,
      "Nb", "Niobium", "92.90628", 5, 5,
      "Mo", "Molybdenum", "95.96", 6, 5,
      "Tc", "Technetium", "(98)", 7, 5,
      "Ru", "Ruthenium", "101.07", 8, 5,
      "Rh", "Rhodium", "102.9055", 9, 5,
      "Pd", "Palladium", "106.42", 10, 5,
      "Ag", "Silver", "107.8682", 11, 5,
      "Cd", "Cadmium", "112.411", 12, 5,
      "In", "Indium", "114.818", 13, 5,
      "Sn", "Tin", "118.71", 14, 5,
      "Sb", "Antimony", "121.76", 15, 5,
      "Te", "Tellurium", "127.6", 16, 5,
      "I", "Iodine", "126.90447", 17, 5,
      "Xe", "Xenon", "131.293", 18, 5,
      "Cs", "Caesium", "132.9054", 1, 6,
      "Ba", "Barium", "132.9054", 2, 6,
      "La", "Lanthanum", "138.90547", 4, 9,
      "Ce", "Cerium", "140.116", 5, 9,
      "Pr", "Praseodymium", "140.90765", 6, 9,
      "Nd", "Neodymium", "144.242", 7, 9,
      "Pm", "Promethium", "(145)", 8, 9,
      "Sm", "Samarium", "150.36", 9, 9,
      "Eu", "Europium", "151.964", 10, 9,
      "Gd", "Gadolinium", "157.25", 11, 9,
      "Tb", "Terbium", "158.92535", 12, 9,
      "Dy", "Dysprosium", "162.5", 13, 9,
      "Ho", "Holmium", "164.93032", 14, 9,
      "Er", "Erbium", "167.259", 15, 9,
      "Tm", "Thulium", "168.93421", 16, 9,
      "Yb", "Ytterbium", "173.054", 17, 9,
      "Lu", "Lutetium", "174.9668", 18, 9,
      "Hf", "Hafnium", "178.49", 4, 6,
      "Ta", "Tantalum", "180.94788", 5, 6,
      "W", "Tungsten", "183.84", 6, 6,
      "Re", "Rhenium", "186.207", 7, 6,
      "Os", "Osmium", "190.23", 8, 6,
      "Ir", "Iridium", "192.217", 9, 6,
      "Pt", "Platinum", "195.084", 10, 6,
      "Au", "Gold", "196.966569", 11, 6,
      "Hg", "Mercury", "200.59", 12, 6,
      "Tl", "Thallium", "204.3833", 13, 6,
      "Pb", "Lead", "207.2", 14, 6,
      "Bi", "Bismuth", "208.9804", 15, 6,
      "Po", "Polonium", "(209)", 16, 6,
      "At", "Astatine", "(210)", 17, 6,
      "Rn", "Radon", "(222)", 18, 6,
      "Fr", "Francium", "(223)", 1, 7,
      "Ra", "Radium", "(226)", 2, 7,
      "Ac", "Actinium", "(227)", 4, 10,
      "Th", "Thorium", "232.03806", 5, 10,
      "Pa", "Protactinium", "231.0588", 6, 10,
      "U", "Uranium", "238.02891", 7, 10,
      "Np", "Neptunium", "(237)", 8, 10,
      "Pu", "Plutonium", "(244)", 9, 10,
      "Am", "Americium", "(243)", 10, 10,
      "Cm", "Curium", "(247)", 11, 10,
      "Bk", "Berkelium", "(247)", 12, 10,
      "Cf", "Californium", "(251)", 13, 10,
      "Es", "Einstenium", "(252)", 14, 10,
      "Fm", "Fermium", "(257)", 15, 10,
      "Md", "Mendelevium", "(258)", 16, 10,
      "No", "Nobelium", "(259)", 17, 10,
      "Lr", "Lawrencium", "(262)", 18, 10,
      "Rf", "Rutherfordium", "(267)", 4, 7,
      "Db", "Dubnium", "(268)", 5, 7,
      "Sg", "Seaborgium", "(271)", 6, 7,
      "Bh", "Bohrium", "(272)", 7, 7,
      "Hs", "Hassium", "(270)", 8, 7,
      "Mt", "Meitnerium", "(276)", 9, 7,
      "Ds", "Darmstadium", "(281)", 10, 7,
      "Rg", "Roentgenium", "(280)", 11, 7,
      "Cn", "Copernicium", "(285)", 12, 7,
      "Uut", "Unutrium", "(284)", 13, 7,
      "Fl", "Flerovium", "(289)", 14, 7,
      "Uup", "Ununpentium", "(288)", 15, 7,
      "Lv", "Livermorium", "(293)", 16, 7,
      "Uus", "Ununseptium", "(294)", 17, 7,
      "Uuo", "Ununoctium", "(294)", 18, 7
    ];
    var camera, scene, renderer;
    var controls;
    var objects = [];
    var targets = { table: [], sphere: [], helix: [], grid: [] };
    init();
    animate();
    function init() {
      camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000);
      camera.position.z = 3000;
      scene = new THREE.Scene();
      for (var i = 0; i < table.length; i += 5) {
        var element = document.createElement('div');
        element.className = 'element';
        element.style.backgroundColor = 'rgba(0,127,127,' + (Math.random() * 0.5 + 0.25) + ')';
        var number = document.createElement('div');
        number.className = 'number';
        number.textContent = (i / 5) + 1;
        element.appendChild(number);
        var symbol = document.createElement('div');
        symbol.className = 'symbol';
        symbol.textContent = table[i];
        element.appendChild(symbol);
        var details = document.createElement('div');
        details.className = 'details';
        details.innerHTML = table[i + 1] + '<br>' + table[i + 2];
        element.appendChild(details);
        var object = new THREE.CSS3DObject(element);
        object.position.x = Math.random() * 4000 - 2000;
        object.position.y = Math.random() * 4000 - 2000;
        object.position.z = Math.random() * 4000 - 2000;
        scene.add(object);
        objects.push(object);
        var object = new THREE.Object3D();
        object.position.x = (table[i + 3] * 140) - 1330;
        object.position.y = - (table[i + 4] * 180) + 990;
        targets.table.push(object);
      }
      var vector = new THREE.Vector3();
      for (var i = 0, l = objects.length; i < l; i++) {
        var phi = Math.acos(-1 + (2 * i) / l);
        var theta = Math.sqrt(l * Math.PI) * phi;
        var object = new THREE.Object3D();
        object.position.x = 800 * Math.cos(theta) * Math.sin(phi);
        object.position.y = 800 * Math.sin(theta) * Math.sin(phi);
        object.position.z = 800 * Math.cos(phi);
        vector.copy(object.position).multiplyScalar(2);
        object.lookAt(vector);
        targets.sphere.push(object);
      }
      var vector = new THREE.Vector3();
      for (var i = 0, l = objects.length; i < l; i++) {
        var phi = i * 0.175 + Math.PI;
        var object = new THREE.Object3D();
        object.position.x = 900 * Math.sin(phi);
        object.position.y = - (i * 8) + 450;
        object.position.z = 900 * Math.cos(phi);
        vector.x = object.position.x * 2;
        vector.y = object.position.y;
        vector.z = object.position.z * 2;
        object.lookAt(vector);
        targets.helix.push(object);
      }
      for (var i = 0; i < objects.length; i++) {
        var object = new THREE.Object3D();
        object.position.x = ((i % 5) * 400) - 800;
        object.position.y = (- (Math.floor(i / 5) % 5) * 400) + 800;
        object.position.z = (Math.floor(i / 25)) * 1000 - 2000;
        targets.grid.push(object);
 
      }
      renderer = new THREE.CSS3DRenderer();
      renderer.setSize(window.innerWidth, window.innerHeight);
      renderer.domElement.style.position = 'absolute';
      document.getElementById('container').appendChild(renderer.domElement);
      controls = new THREE.TrackballControls(camera, renderer.domElement);
      controls.rotateSpeed = 0.5;
      controls.minDistance = 500;
      controls.maxDistance = 6000;
      controls.addEventListener('change', render);
      var button = document.getElementById('table');
      button.addEventListener('click', function (event) {
        transform(targets.table, 2000);
      }, false);
      var button = document.getElementById('sphere');
      button.addEventListener('click', function (event) {
        transform(targets.sphere, 2000);
 
      }, false);
      var button = document.getElementById('helix');
      button.addEventListener('click', function (event) {
 
        transform(targets.helix, 2000);
      }, false);
      var button = document.getElementById('grid');
      button.addEventListener('click', function (event) {
 
        transform(targets.grid, 2000);
      }, false);
      transform(targets.table, 5000);
      window.addEventListener('resize', onWindowResize, false);
    }
    function transform(targets, duration) {
      TWEEN.removeAll();
      for (var i = 0; i < objects.length; i++) {
        var object = objects[i];
        var target = targets[i];
        new TWEEN.Tween(object.position)
          .to({ x: target.position.x, y: target.position.y, z: target.position.z }, Math.random() * duration + duration)
          .easing(TWEEN.Easing.Exponential.InOut)
          .start();
 
        new TWEEN.Tween(object.rotation)
          .to({ x: target.rotation.x, y: target.rotation.y, z: target.rotation.z }, Math.random() * duration + duration)
          .easing(TWEEN.Easing.Exponential.InOut)
          .start();
      }
      new TWEEN.Tween(this)
        .to({}, duration * 2)
        .onUpdate(render)
        .start();
 
    }
    function onWindowResize() {
      camera.aspect = window.innerWidth / window.innerHeight;
      camera.updateProjectionMatrix();
      renderer.setSize(window.innerWidth, window.innerHeight);
      render();
 
    }
    function animate() {
      requestAnimationFrame(animate);
      TWEEN.update();
      controls.update();
    }
    function render() {
      renderer.render(scene, camera);
    }
</script>
</body>
 
</html>


代码分析

这段代码是一个使用HTML、CSS和JavaScript创建的元素周期表。代码中使用了Three.js库来实现3D效果,以及Tween.js库来实现动画效果。


HTML部分定义了页面结构,包括一个用于渲染3D内容的容器div以及一个菜单div,用于切换不同的布局模式。CSS部分定义了页面的样式,包括元素的外观和布局。


JavaScript部分是整个交互的核心。通过创建Three.js中的摄像机、场景、渲染器以及控制器,实现了3D效果的展示和交互。元素数据存储在一个数组中,然后根据不同的布局模式,计算每个元素应该在3D空间中的位置,并使用Tween.js库实现平滑的过渡效果。点击菜单按钮时,调用transform函数,根据选择的布局模式对元素进行重新排列。同时,通过监听窗口大小变化的事件,实现页面响应式布局。


总的来说,这段代码实现了一个具有吸引力的周期表元素的交互式可视化展示,展示了HTML、CSS和JavaScript之间的良好结合,以及如何利用Three.js库创建3D场景和交互效果。

下载代码

(●'◡'●)除了以上的代码,还需要一些js文件哦,在公众号的对话框内回复“html017”即可下载所有的文件喔~

写在最后

我是一只有趣的兔子,感谢你的喜欢o(* ̄▽ ̄*)ブ!

目录
相关文章
|
1月前
|
移动开发 开发者 UED
HTML5 语义元素详解
HTML5引入了诸多语义元素
WK
|
1月前
|
存储 移动开发 前端开发
HTML5新增了哪些其他元素和属性
这段文字介绍了HTML5中新增的多种元素和属性,包括页面布局元素如header、nav等,表单元素如email、tel输入框等,以及其他元素如canvas、svg等。此外,还介绍了全局及表单属性,例如contenteditable、placeholder等,这些新功能显著增强了HTML5在现代网页设计与开发中的实用性与灵活性。
WK
50 1
|
2月前
|
JavaScript 前端开发 容器
用HTML DOM实现有条件地渲染网页元素(上)
用HTML DOM实现有条件地渲染网页元素(上)
|
2月前
|
存储 JavaScript 前端开发
用HTML DOM实现有条件地渲染网页元素(下)
用HTML DOM实现有条件地渲染网页元素(下)
|
21天前
HTML 元素
HTML文档由HTML元素定义,元素包括开始标签、内容和结束标签。某些元素内容为空,可在开始标签中关闭。大多数元素可拥有属性,且元素间可相互嵌套,形成复杂结构。
|
2月前
|
移动开发 前端开发 HTML5
Twaver-HTML5基础学习(8)拓扑元素(Element)_网元(Element)、节点(Node)
本文介绍了Twaver HTML5中的拓扑元素(Element),包括网元(Element)、节点(Node)和连线(Link)的基本概念和使用方法。文章详细解释了Element的属性和方法,并通过示例代码展示了如何在React组件中创建节点、设置节点属性和样式。
41 1
Twaver-HTML5基础学习(8)拓扑元素(Element)_网元(Element)、节点(Node)
|
2月前
|
移动开发 前端开发 JavaScript
Twaver-HTML5基础学习(7)Layer图层元素
本文介绍了Twaver HTML5中的图层元素(Layer),包括图层的属性和使用方法。文章详细解释了如何创建图层、设置图层属性(如可见性、可编辑性、可移动性和可旋转性),并通过示例代码展示了如何在React组件中使用图层。
39 1
Twaver-HTML5基础学习(7)Layer图层元素
|
2月前
|
移动开发 JavaScript 前端开发
Twaver-HTML5基础学习(6)告警元素(Alarm)闪烁效果
本文介绍了在Twaver HTML5中如何为告警元素(Alarm)创建闪烁效果,以提醒用户注意。文章通过示例代码展示了如何通过定时器间隔性地改变告警标签的颜色,从而实现闪烁提示效果。
36 1
Twaver-HTML5基础学习(6)告警元素(Alarm)闪烁效果
|
2月前
|
移动开发 前端开发 HTML5
Twaver-HTML5基础学习(2)基本数据元素(Data)
本文介绍了Twaver HTML5中的基本数据元素,包括Data、Element、Alarm和Layer等,它们分别用来描述拓扑的网元、告警和图层。文章详细解释了Data类的基本属性和方法,并提供了如何在React组件中使用Twaver创建节点和连线的示例代码。
43 1
Twaver-HTML5基础学习(2)基本数据元素(Data)
|
1月前
|
移动开发 数据安全/隐私保护 UED
HTML5 表单元素详解
HTML5 引入了新的表单元素和属性,如 `&lt;form&gt;、&lt;input&gt;、&lt;textarea&gt;、&lt;select&gt;` 和 `&lt;button&gt;`,以及 `required、min、max` 等属性,增强了表单的创建与交互。其中,`&lt;input&gt;` 支持多种类型如 `email、url、date` 等,提供了更好的用户体验和数据验证。此外,HTML5 还新增了原生表单验证功能,简化了开发流程并提升了安全性。

热门文章

最新文章