Modal pop-up tutorial Video Demo HTML Modals Modals Lorem ipsum dolor sit amet, consectetur adipiscing elit... Click here! Ut euismod sapien massa, a pulvinar metus condimentum in... Click here as well! Sed auctor malesuada quam... Fusce vel ipsum eu sem consectetur dignissim at in orci.. Click here as well! This is message 1Some text in bold This is message 2 Modal content goes here X CSS *{ padding: 0; margin: 0; box-sizing: border-box; } p{ margin: 10px 0; } .page{ max-width: 700px; margin:20px auto; } .overlay-outer{ display: none; position:fixed; top: 0; left: 0; width:100%; height:100%; background: rgba(256,256,256,0.8); } .overlay-inner{ display:table-cell; vertical-align:middle; text-align:center; } .overlay-content{ display:inline-block; background:#eee; box-shadow: 1px 1px 3px #444; padding: 1rem; position:relative; } .close-btn{ position:absolute; right: -10px; top: -10px; padding:5px 8px; background:#111; color:#fff; border:none; cursor:pointer; } JavaScript Insert or this code in your document within script tags just before the closing body tag function pageLoad () { //Handler functions for the events function openModal (event) { event.preventDefault (); modalString.innerHTML = document.querySelector(this.getAttribute('href')).innerHTML; overlayOuter.style.display = 'table'; } function closeModal () { modalString.innerHTML = ''; overlayOuter.style.display = 'none'; } //Reference the DOM elements var overlayOuter = document.getElementById('overlay-outer'); var modalString = document.getElementById('modal-string'); var closeOverlay = document.getElementById('close-btn'); var modalLinks = document.querySelectorAll('.modal-link'); //Attach eventlisteners to the elements for (var i = 0; i < modalLinks.length; i++){ modalLinks[i].addEventListener('click', openModal, false); } closeOverlay.addEventListener('click', closeModal, false); } window.addEventListener('load', pageLoad);