<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Menu</title> <style>@font-face { font-family: 'EYInterstatelight'; src: url(fonts/eyinterstate-light.eot); src: url('fonts/eyinterstate-light.eot?#iefix') format('embedded-opentype'), url(fonts/eyinterstate-light.woff2) format('woff2'), url(fonts/eyinterstate-light.woff) format('woff'), url(fonts/eyinterstate-light.ttf) format('truetype'), url('fonts/eyinterstate-light.svg#eyinterstate-light') format('svg'); font-weight: 400; font-style: normal } @font-face { font-family: 'EYInterstatelightBold'; src: url(fonts/eyinterstate-light-bold.eot); src: url('fonts/eyinterstate-light-bold.eot?#iefix') format('embedded-opentype'), url(fonts/eyinterstate-light-bold.woff2) format('woff2'), url(fonts/eyinterstate-light-bold.woff) format('woff'), url(fonts/eyinterstate-light-bold.ttf) format('truetype'), url('fonts/eyinterstate-light-bold.svg#eyinterstate-light-bold') format('svg'); font-weight: 700; font-style: normal } html, body { margin: 0 0 0 0; overflow:hidden; } *{ box-sizing: border-box; } body { font-family: 'EYInterstatelight'; } .ui-menu { width: 150px } #menu { background: #282b32; padding: 0; margin: 0; width: 50%; margin: 0 auto } #menu .title { display: block; line-height: 18px; text-decoration: none; position: relative; } .expand:after { content: ''; display: inline-block; padding: 3px; background: transparent url('images/plus-icon.png') no-repeat scroll top left; width: 10px; height: 14px; position: absolute; top: 57%; left: 15px; margin-top: -7px; } .collapse:after { content: ''; display: inline-block; padding: 3px; background: transparent url('images/minus-icon.png') no-repeat scroll top left; width: 10px; height: 14px; position: absolute; top: 57%; left: 15px; margin-top: -7px; } .collapse, .expand { display: block; color: #ffe600; text-align: center; float: left; cursor: pointer; width: 25px; height: 62px; line-height: 62px; position: absolute; border: 0; background: transparent; z-index: 1; } .empty { display: block; color: #ffe600; text-align: center; float: left; cursor: pointer; width: 25px; height: 35px; line-height: 35px } .title { display: block; border-bottom: 2px solid rgba(133, 133, 133, 0.4); box-sizing: border-box; -webkit-box-sizing: border-box; } .title::after { content: ''; position: absolute; background: transparent url('images/disable-icon.png') no-repeat scroll center center; width: 17px; height: 17px; right: 10px; top: 50%; margin: -11px 0 0 0; } .title.completed::after { content: ''; position: absolute; background: transparent url('images/normal-icon.png') no-repeat scroll center center; width: 17px; height: 17px; right: 10px; top: 50%; margin: -14px 0 0 0; } ul { list-style: none; padding: 0; margin: 0 } ul li { position: relative } ul li ul li:last-child { border-bottom: none } ul > li, ul > li > ul, ul > li > ul > li { list-style: none } ul li span.title .liChild { text-decoration: none; cursor: pointer; display: block; padding: 20px 30px 20px 40px; pointer-events: auto; margin: 0; font-size: 18px; line-height: 22px; color: #fff; background-color: #282b32; border: 0; width: 100%; text-align: left } ul li span.title .liChild.disablePage { color: #747480; pointer-events: none; } /*ul li span.title .liChild.current { color: #2e2e38; background: #ffe600; margin-left: 25px }*/ ul li span.title .liChild:hover { text-decoration: none } ul > li > ul, ul > li > ul > li { padding: 0; margin: 0 } .active > span.title { background-color: #646464 } .active > span.title .liChild { color: #27ACAA; font-weight: 700 } ul#menu li > span.expand + span.title + ul li > span.title, ul > li > ul > li span.expand, ul > li > ul > li span.collapse, ul#menu li > span.empty + span.title + ul li > span.title, ul > li > ul > li span.empty { padding-left: 30px } ul#menu li > span.expand + span.title + ul li > span.expand + span.title + ul li span.title, ul#menu li > span.empty + span.title + ul li > span.empty + span.title + ul li span.title { padding-left: 75px } ul > li.complete > span.title::before { content: ' '; background: none no-repeat; background-size: 17px 17px; position: absolute; width: 17px; height: 17px; right: 9px; top: 9px } ul.subMenu li .liChild { padding-left: 15px } ul.subMenu { /*transition: opacity 1s ease-out; opacity: 0;*/ height: 0; overflow: hidden } ul.subMenu.visible { /*transition: opacity 1s ease-out;*/ opacity: 1; height: auto } #menu { width: 100%; height: 768px; } #menu .headerWrapper .closePop { background: transparent url(images/close_m.png); border: 0; position: absolute; right: 5px; top: 0px; cursor: pointer; height: 40px; width: 40px; display: inline-block } #menu .headerWrapper .closePop:hover { background-image: url("images/close_m_hover.png"); } #menu .headerWrapper h4.modalTitle { color: #ffe600; font-weight: 700; font-size: 20px; } #menu .modalBoday { height: 728px; overflow-y: auto } #menu .modalBox { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1050; display: block; overflow: hidden; -webkit-overflow-scrolling: touch; outline: 0 } #menu .modalContentWrapper { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5); box-shadow: 0 5px 15px rgba(0, 0, 0, .5) } #menu .headerWrapper { background: #282b32; position: relative; height: 40px; line-height: 40px; padding: 0 15px 0 15px; border-bottom: 1px solid rgba(116, 116, 128, 0.4); } #menu .headerWrapper h4 img { margin-right:5px; padding-bottom: 2px; } #menu .closePop { position: absolute; right: 15px; top: 0; cursor: pointer } #menu .closePop img { height: 40px; width: 40px } #menu .modalBoday { position: relative; padding: 0 0 4px 0 } #menu .headerWrapper h4 { margin: 0; color: #ffe600; font-weight: 700; font-size: 20px } #menu .modalContentWrapper, #menu .modalWrapper { position: absolute; width: 100%; height: 768px; } #menu .leftBlock, #menu .rightBlock { width: 46%; float: left; padding: 0 1.5% 0 1.5%; display: flex; align-items: center } #menu .modalBoday { position: relative; padding: 0; height: 688px; } #course_title { margin: 0; height: 0 } ul.subMenu li span.subMenu_title { padding-left: 0 } ul.subMenu li span.subMenu_title .liChild { padding-left: 35px; } ul#menu_list li span.title .liChild.current { margin-left: 0; color: #2e2e38; background-color: #ffe600; } ul#menu_list li span.title .liChild:hover { color: #2e2e38; background-color: #ffe600; /*background: #191700;*/ /*transition: background-color 0.5s ease*/ } ul#menu_list > li { border-bottom: none; position: relative; box-sizing: border-box; -webkit-box-sizing: border-box; } </style> <meta charset="UTF-8"> <title>Menu</title> </head> <script src="js/bluebird.min.js"></script> <script>var frameDataObj; function globalProvideData(a, b) { frameDataObj = JSON.parse(b) }</script> <script type="text/javascript" src="../../../html5/data/js/frame.js"></script> <body onload="addFocus()"> <div id="menu" class="modalBox" tabindex="-1"> <div class="modalWrapper" tabindex="-1"> <div class="modalContentWrapper" tabindex="-1"> <div class="headerWrapper" tabindex="-1"> <button role="application" aria-label="close button to activate press space bar" class="closePop" tabindex="100" onfocusout="addFocus()" onClick="closePopup()" name="close"></button> <h4 id="title" class="modalTitle" tabindex="1" onfocusout="getFocus()" role="application">Menu</h4> </div> <div class="modalBoday" tabindex="-1"> <div id="course_title" tabindex="1"></div> <div tabindex="-1"> <ul id="menu_list" tabindex="-1"></ul> </div> </div> </div> </div> </div> </body> <script>var player; var level = 0; var topic = 0; var coursePCnt = 0; var currLesson; var currPage; var pageVisitArray = []; var lessonStartPageArray; var pageVisitedArray; var pageVisitedArrayTemp; var lessonStartPageArrayTemp; var mainDocDiv = parent.document.getElementById("main-window"); var topicNum = []; var lastTopicNumber; function addFocus() { player = parent.GetPlayer(); if (document.getElementById("title")) { document.getElementById("title").focus() } } function getFocus() { player = parent.GetPlayer(); if (document.getElementById("course_title")) { document.getElementById("course_title").focus() } } function closePopup() { player.SetVar("sh_isMenuClicked", "0"); mainDocDiv.setAttribute("Alt", " "); mainDocDiv.focus() } function dynamicEvent(evt) { var cur_id = evt.target.id; var targetClkd = evt.target; var cur_elem = cur_id.substring(cur_id.indexOf("_") + 1, cur_id.length); for (var i = 1; i <= topic; i++) { var elem_id = "sublist_" + i; if (cur_id !== elem_id) { var collapseID = document.getElementById("sublist_" + i); collapseID.nextSibling.nextSibling.classList.remove("visible"); collapseID.classList.remove("collapse") } } targetClkd.nextSibling.nextSibling.classList.toggle("visible"); targetClkd.classList.toggle("collapse") } function showPageName(evt) { var classListArr = evt.target.classList; if (!classListArr.contains("disablePage")) { var jumpNum = Number(evt.target.id); player.SetVar("sh_isMenuClicked", "0"); player.SetVar("sh_menuItemClicked", jumpNum) } else { } } function updateMenu() { player = parent.GetPlayer(); lessonStartPageArray = player.GetVar("lessonStartPageArray"); pageVisitedArray = player.GetVar("pageVisitedArray"); currLesson = Number(player.GetVar("sh_lessonNum")); currPage = Number(player.GetVar("sh_currentPage")); pageVisitedArrayTemp; lessonStartPageArrayTemp; if (typeof pageVisitedArray == "string") { pageVisitedArrayTemp = pageVisitedArray.split(",") } if (typeof lessonStartPageArray == "string") { lessonStartPageArrayTemp = lessonStartPageArray.split(",") } //console.log(lessonStartPageArrayTemp); //console.log(pageVisitedArrayTemp); } function updateStatus(currLesson, curPgStatus, coursePCnt, iDivelem) { <!-- iDivelem.classList.remove("disablePage"); --> var topicParentDiv; if (curPgStatus == 1) { iDivelem.classList.remove("disablePage"); if(iDivelem.getAttribute('level')== "2"){ iDivelem.parentNode.classList.add('completed'); } } else if (pageVisitedArrayTemp[coursePCnt - 1] == 0) { iDivelem.className = "liChild" } if (currPage == coursePCnt) { iDivelem.classList.remove("disablePage"); iDivelem.classList.add("current") } } function loadMenu() { var menuObj = frameDataObj.navData.outline.links; var el = document.getElementById("menu_list"); var page_name, page_link, linkString, link; var tnodeID; updateMenu(); function getMenuElems(obj, level) { level++; var pageNum = 0; for (subObjNum in obj) { pageNum++; coursePCnt++; var curPgStatus = pageVisitedArrayTemp[coursePCnt - 1]; var subObj = obj[subObjNum]; var spanTxt = document.createElement("span"); page_name = subObj.displaytext; page_link = subObj.slideid; var iDiv = document.createElement("button"); iDiv.id = coursePCnt; iDiv.innerHTML = page_name; iDiv.setAttribute("tabindex", coursePCnt); iDiv.className = "liChild disablePage"; iDiv.setAttribute("level", level); iDiv.setAttribute("onclick", "showPageName(event); return false;"); if (subObj.hasOwnProperty("links")) { topic++; var sub_node_grp = document.createElement("ul"); sub_node_grp.className = "subMenu"; var spanExpand = document.createElement("button"); var spanExpandID = "sublist_" + pageNum; spanExpand.className = "expand"; spanExpand.name = "expand"; spanExpand.setAttribute("aria-label", "expand collapse"); spanExpand.setAttribute("onclick", "dynamicEvent(event); return false;"); spanExpand.setAttribute("id", spanExpandID); spanExpand.setAttribute("tabindex", coursePCnt); var tnode = document.createElement("li"); tnodeID = "topic_" + topic; tnode.setAttribute("id", tnodeID); tnode.setAttribute("role", "application"); tnode.className = "expand_subMenu"; tnode.appendChild(spanExpand); tnode.appendChild(spanTxt); tnode.appendChild(sub_node_grp); el.appendChild(tnode); spanTxt.className = "subMenu_title title"; spanTxt.appendChild(iDiv); topicNum.push(topic); updateStatus(currLesson, curPgStatus, coursePCnt, iDiv); getMenuElems(subObj.links, level); } else { var pnode = document.createElement("li"); pnodeID = "page_" + topic + "_" + pageNum; pnode.setAttribute("id", pnodeID); pnode.setAttribute("role", "application"); pnode.appendChild(spanTxt); spanTxt.className = "page_title title"; spanTxt.appendChild(iDiv); var nodeToAppend = document.getElementById(tnodeID).getElementsByClassName("subMenu")[0]; nodeToAppend.appendChild(pnode); updateStatus(currLesson, curPgStatus, coursePCnt, iDiv) } } } var promise = new Promise(function (resolve, reject) { getMenuElems(menuObj, level); if (1 == 1) { resolve(); } else { reject() } }); promise.then(function (result) { var expandDiv = document.getElementById("sublist_" + currLesson); expandDiv.click(); var getTopicDivs = document.getElementsByClassName("expand_subMenu"); //console.log('getTopicDivs', getTopicDivs); Array.prototype.forEach.call(getTopicDivs, function(el) { // Do stuff here if(el.querySelectorAll(".page_title").length == el.querySelectorAll(".completed").length){ var iDivelem = el.getElementsByClassName("subMenu_title")[0]; //console.log(iDivelem) //iDivelem.classList.remove("disablePage"); iDivelem.classList.add('completed'); }; }); var divToScroll = document.getElementById("page_" + currLesson + "_" + currPage); divToScroll.scrollTop = divToScroll.offsetTop; }, function (err) { console.log(err) }) }; loadMenu(); var focElem = document.getElementById("sublist_1"); var wheelfocus = false; window.addEventListener('wheel', function () { if (!wheelfocus) { wheelfocus = true; focElem.focus() } });</script> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>