HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<ul class="flowchart">
<li>*collapse*Element 01 (level 01)</li>
<ul>
<li>Child 01 of Element 01 (level 02)</li>
</ul>
<li>Element 02 (level 01)</li>
<ul>
<li>Child 01 of Element 02 (level 02)</li>
<ul>
<li>Child of Element 02 (level 03)</li>
<ul>
<li>Child of Element 02 (level 04)</li>
</ul>
</ul>
<li>Child 02 of Element 02 (level 02)</li>
</ul>
<li>Element 03 (level 01)</li>
</ul>
html, body {}
.flowchart{width: 500px;margin:0 auto 15px;}
.flowchart .longer{
/* border-left:1px solid #C5C5C5; */
padding-left: 15%;
margin-left: -15px /*!important*/;
display:none;
}
.flowchart .short{
padding-left: 15%;
margin-left: -15px /*!important*/;
display:none;
}
.flowchart p, .flowchart a, .flowchart li, .flowchart span{color:#fff !important;*color:#000;text-align:left;text-decoration: none;text-decoration: none !important;border-bottom:none !important;}
.flowchart ul{list-style:none;margin: 0;padding: 0;}
.flowchart ul li{margin-top: 10px;}
.flowchart ul li p{margin:0;padding: 5px;padding-left: 30px;background: #f47321;}
.flowchart ul li ul li p{background: #A8B2BB;}
.flowchart ul ul{margin-left: 70px;}
.flowchart ul ul li{
border-left:1px solid #C5C5C5;
margin: 0 0 0 -15px;
padding: 8px 0 0 15px;
}
.flowchart ul ul li:after{
content: "-";
color: #fff;
float: left;
margin-left: -16px;
margin-top: -21px;
border-left: 1px solid #C5C5C5;
border-bottom: 1px solid #C5C5C5;
padding-right: 10px;
}
.flowchart ul ul li p{background:#7686c2;}
.flowchart ul ul ul{margin-left: 15%;}
.flowchart .short ul ul ul ul ul ul ul ul, .flowchart .longer ul ul ul ul ul ul ul ul{padding-left: 40px;}
/** COMPARE LATER WITH MENUBOX OF SIDENAV **/
.flowchart .menuBox{
cursor: pointer;
width: 18px;
float: left;
height: 22px;
margin-left: 6px; /* IE8 and below */
margin-top:3px\9;
}
.flowchart .unfoldArrow{
width: 18px;
float: left;
height: 22px;
margin-left: 6px;
background: url(/images/sidebarMenu/downMenu-arrow-white.gif) no-repeat 9px 4px;
}
.flowchart .finalLink{
background-image: url(/images/sidebarMenu/menu-arrow-white.gif);
background-repeat: no-repeat;
background-position:9px 4px;
}
.flowchart .firstLevel{
background-color:#f47321;
}
.flowchart .secondLevel{
background-color:#7686c2;
}
.flowchart .thirstLevel{
background-color:#98a2d2;
}
.flowchart span {
margin-top: -2px;
display: list-item;
-webkit-box-shadow: 0 10px 0 1px #fff, 0 16px 0 1px #fff, 0 22px 0 1px #fff;
box-shadow: 0 10px 0 1px #fff, 0 16px 0 1px #fff, 0 22px 0 1px #fff;
background:url(/images/sidebarMenu/menu_icon_for_IE.gif) no-repeat\9; /* IE8 and below */
margin-top: 3px\9; /* IE8 and below */
height:16px\9; /* IE8 and below */
}
.flowchart .clicked{
margin-left: 9px;
width: 1px;
-webkit-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-moz-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-o-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-ms-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
transition: width 0.2s ease-out, margin-left 0.2s ease-out;
margin-left: 8px\9; /* IE8 and below */
width: 4px\9; /* IE8 and below */
}
.flowchart .notclicked{
width: 16px;
-webkit-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-moz-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-o-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
-ms-transition: width 0.2s ease-out, margin-left 0.2s ease-out;
transition: width 0.2s ease-out, margin-left 0.2s ease-out;
width:20px\9; /* IE8 and below */
height:16px\9; /* IE8 and below */
}
/*
THIS CODE WILL HELP (IT'S NECESSARY) TO CREATE THE "FLOWCHART VIEW" STYLE
ON THE LIST WITH "FLOWCHART" STYLE SELECTED.
*/
$(document).ready(function(){
// THIS FUNCTION ALLOW IE TO DEAL WITH "GET ELEMENTS BY CLASS NAME"
function getElementsByClassName(node, classname) {
var a = [];
var re = new RegExp('(^| )'+classname+'( |$)');
var els = node.getElementsByTagName("*");
for(var i=0,j=els.length; i<j; i++)
if(re.test(els[i].className))a.push(els[i]);
return a;
}
// this variable will just check if we are on a template with a flowchart inside.
var flowcharts = getElementsByClassName(document.body,'flowchart'); // no document
// IN CASE THERE IS A FLOWCHART LIST, THE FUN WILL START
if($(flowcharts).html() != undefined){
// FIRSTLY IT'S COUNTED HOW MANY FLOWCHART ARE THERE
for(var m = 0; m < flowcharts.length; m++){
var tempFlowchart = flowcharts[m];
var collapseOption = ''; // THIS VARIABLE WILL BE USED AS A SETTING TO FOLD OR NOT THE FLOWCHART
// UMBRACO RETURN THE TEXT INSIDE "LI" WITHOUT "P", SO WE NEED TO GET ALL OF THEM AND MAKE IT PROPERLY
var paragraphsList = tempFlowchart.getElementsByTagName('li');
for(var i = 0; i < paragraphsList.length; i++){
var tempParagraph = paragraphsList[i];
// NEXT CONDITION WILL LOOK FOR THE SETTING TO FOLD OR UNFOLD THE FLOWCHART
if(collapseOption === ''){
// IF THE WORD COLLAPSE IS IN THE FIRST PARAGRAPH BETWEEN '*' ...
var settingsRemoved = $(tempParagraph).html(),
settings = settingsRemoved.split('*');
// ...WE TAKE IT OUT FROM THE TEXT, AND SAVE IT FOR LATER IN A VARIABLE
collapseOption = settings[1];
// THE ORIGINAL HTML IS OVERWRITTEN WITH THE NEW ONE, WITHOUT "COLLAPSE" ON IT
$(tempParagraph).html(settings[2]);
}
// THIS FUNCTION WILL CUT OUT ANY TEXT BETWEEN [ AND ], AND IT WILL BE ADDED AS "TITLE" TO THE PARAGRAPH
var html = $(tempParagraph).html(),
lText = html.split('['),
rText = html.split(']');
if (typeof rText[0] === "undefined")
{rText[0] = ""}
if (typeof rText[1] === "undefined")
{rText[1] = ""}
if (typeof lText[0] === "undefined")
{lText[0] = ""}
if (typeof lText[1] === "undefined")
{lText[1] = ""}
var titleText = lText[1].split(']');
$(tempParagraph).attr({ title: titleText[0] });
$(tempParagraph).html(lText[0]+rText[1]);
var finalParagraph = $(tempParagraph).html();
// IF THERE IS NOT CHILDS, IN WON'T HAVE FOLDED MENU ICON
if($(tempParagraph).next('ul').text() == ''){
$(tempParagraph).text('');
if($(tempParagraph).parent().prop("class") === 'flowchart'){
$(tempParagraph).append("<p class='finalLink firstLevel'>"+ finalParagraph +"</p>");
}else if($(tempParagraph).parent().parent().prop("class") === 'flowchart'){
$(tempParagraph).append("<p class='finalLink secondLevel'>"+ finalParagraph +"</p>");
}else{
$(tempParagraph).append("<p class='finalLink thirstLevel'>"+ finalParagraph +"</p>");
}
}else // IT WILL HAVE FOLDED MENU ICON IF THERE IS CHILDS
{
$(tempParagraph).text('');
if(collapseOption =="collapse"){
$(tempParagraph).append("<div class='menuBox'><span class='notclicked'></span></div><p>"+ finalParagraph +"</p>");
}else{
$(tempParagraph).append("<div class='unfoldArrow'></div><p>"+ finalParagraph +"</p>");
}
}
};
// WITH THE NEXT CLASSES WE WILL ADD A LINE AT LEFT SIDE IN CASE THERE IS MORE SECTIONS IN THE SAME LEVEL
var list = tempFlowchart.getElementsByTagName('ul');
for(var i = 0; i < list.length; i++){
var temp = list[i];
if($(temp).next('li').text() != ''){
// LONGER WILL ADD THE LINE
$(temp).addClass('longer');
}else{
// SHORT WON'T ADD THE LINE
$(temp).addClass('short');
}
}
// CREATE A NEW DIV WITH A CLASS CALLED "FLOWCHART"
$(tempFlowchart).before("<div class='flowchart flowchartSerial_" + (m+1) + "'></div>");
// SAVE THE CONTENT OF OUR NEW DIV
var flowChartDiv = $('div.flowchartSerial_'+ (m+1));
$(flowChartDiv).append($(tempFlowchart));
// IF 'COLLAPSE' WAS WRITTEN AT THE BEGINNIG OF THE FLOWCHART, IT WILL BE COLLAPSED
if(collapseOption == "collapse"){
$(flowChartDiv).children('ul').children('ul').addClass('opened');
$(flowChartDiv).children('ul').children('ul').slideToggle(350);
$(flowChartDiv).children('ul').children('li').children('.menuBox').children('span').toggleClass("clicked");
$(flowChartDiv).children('ul').children('li').children('.menuBox').children('span').toggleClass("notclicked");
flowchartSlideTest(flowChartDiv);
// OTHERWISE, IT WILL BE NO COLLAPSED
}else{
// THE CLASSES LONGER AND SHORT HAVE A DISPLAY:NONE PROPERTY
// SO THIS WILL OVERWRITE THAT PROPERTIES AND WILL EXPAND ALL
$(flowChartDiv).find('.longer').show();
$(flowChartDiv).find('.short').show();
}
}
}
});
function flowchartSlideTest(variable){
$(variable).find('.menuBox').click(function(event){
var div = $(this).parent('li').next('ul');
if($(div).html() != undefined){
var open = $(variable).children('ul').children('ul').find('.opened');
// IF WE OPENED ANOTHER SECTION BEFORE, IT WILL BE CLOSED BEFORE OPENING THE NEW ONE
if($(open).html() != $(div).html()){
if(!$(this).parent().parent().hasClass('opened')){
$(open).each(function() {
$(this).toggleClass("opened");
$(this).slideToggle(350);
$(this).prev('li').children().children().toggleClass("clicked");
$(this).prev('li').children().children().toggleClass("notclicked");
});
}
}
$(div).each(function(i) {
$(div).slideToggle(350);
$(div).toggleClass("opened");
});
$(this).children().toggleClass("clicked");
$(this).children().toggleClass("notclicked");
};
$(variable).children('ul').children('ul').removeClass('opened');
});
};
Also see: Tab Triggers