Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Curency exchange rate</title>

</head>
<body>
    <script>
        const body = document.querySelector("body");
        body.setAttribute("style", `font-family: Arial, Helvetica, sans-serif; 
        width:70%; margin:auto;`);

        // Create <header/>
        const header = document.createElement("header");
        body.appendChild(header);
        header.setAttribute("style", "background-color: rgb(221, 242, 245);");

        const title = document.createElement("div")
        header.appendChild(title);
            const logo = document.createElement("img");
            logo.setAttribute("src", "https://minfin.com.ua/img/company/1/slogo/logo/privat.jpg");
            logo.setAttribute("style", "width:70px");
            title.appendChild(logo);

            const textTitle = document.createElement("span")
            textTitle.innerHTML = "Приватбанк";
            title.appendChild(textTitle);
            textTitle.setAttribute("style", "font-size:28px; font-weight:700;");

        // Create <main/>
        const main = document.createElement("main");
        header.after(main);
        main.setAttribute("style", "margin-top:16px; background-color:#f7f7f7;");

        const h3 = document.createElement("h3");
        main.appendChild(h3);
        h3.innerHTML = "Курсы валют в Приватбанке";
        h3.setAttribute("style", "text-align: center;");

        // Create <table/>
        const table = document.createElement("table");
        main.append(table);
        table.setAttribute("style", "border-collapse: collapse; margin:auto");

            // <thead/>
            const thead = document.createElement("thead");
            table.appendChild(thead)
            thead.setAttribute("style", "font-size: 16px; color: #b1b1b1; border-bottom: 1px solid #d0d0d0;")
                // <tr/>
                const trHead = document.createElement("tr");
                thead.appendChild(trHead);
                    // <td/>
                    const tdHead1 = document.createElement("td");
                    tdHead1.innerHTML = "Валюта";
                    tdHead1.setAttribute("style", "padding: 9px 0px; width:120px");

                    const tdHead2 = tdHead1.cloneNode(true);
                    tdHead2.innerHTML = "Покупка";

                    const tdHead3 = tdHead1.cloneNode(true);
                    tdHead3.innerHTML = "Продажа";
                trHead.append(tdHead1, tdHead2, tdHead3);
            
            // <tbody/>
            const tbody = document.createElement("tbody");
            thead.after(tbody);
            tbody.setAttribute("style", "font-size: 18px;");
                // row#1
                const tr1Body = document.createElement("tr");
                tbody.appendChild(tr1Body);
                tr1Body.setAttribute("style", "border-bottom: 1px solid #d0d0d0;")

                    const td1tr1Body = document.createElement("td");
                    td1tr1Body.innerHTML = "USD";
                    td1tr1Body.setAttribute("style", "padding: 16px 0px; width:100px");
                    const td2tr1Body = td1tr1Body.cloneNode(true);
                    const td3tr1Body = td1tr1Body.cloneNode(true);

                    td1tr1Body.setAttribute("style", "color:#244696;")
                    td2tr1Body.innerHTML = "27,55";
                    td3tr1Body.innerHTML = "27,85";
                tr1Body.append(td1tr1Body, td2tr1Body, td3tr1Body);
                // row#2
                const tr2Body = tr1Body.cloneNode(false);
                tr1Body.after(tr2Body)

                    const td1tr2Body = td1tr1Body.cloneNode(true);
                    td1tr2Body.innerHTML = "EUR"

                    const td2tr2Body = td2tr1Body.cloneNode(true);
                    td2tr2Body.innerHTML = "33,30"

                    const td3tr2Body = td3tr1Body.cloneNode(true);
                    td3tr2Body.innerHTML = "33,78"
                tr2Body.append(td1tr2Body, td2tr2Body, td3tr2Body);
                // row#3
                const tr3Body = tr1Body.cloneNode(false);
                    tbody.append(tr3Body)

                    const td1tr3Body = td1tr1Body.cloneNode(true);
                    td1tr3Body.innerHTML = "GBP"

                    const td2tr3Body = td2tr1Body.cloneNode(true);
                    td2tr3Body.innerHTML = "37,33"

                    const td3tr3Body = td3tr1Body.cloneNode(true);
                    td3tr3Body.innerHTML = "39,21"
                tr3Body.append(td1tr3Body, td2tr3Body, td3tr3Body);
                // row#4
                const tr4Body = tr1Body.cloneNode(false);
                    tbody.append(tr4Body)

                    const td1tr4Body = td1tr1Body.cloneNode(true);
                    td1tr4Body.innerHTML = "RUB"

                    const td2tr4Body = td2tr1Body.cloneNode(true);
                    td2tr4Body.innerHTML = "0,36"

                    const td3tr4Body = td3tr1Body.cloneNode(true);
                    td3tr4Body.innerHTML = "0,39"
                tr4Body.append(td1tr4Body, td2tr4Body, td3tr4Body);

    </script>

    
</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console