Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

              
                <div id="root">
  Js needed to display this page.
</div>
              
            
!

CSS

              
                /* ************************* */
/* CSS Reset */
/* ************************* */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
    border: 0;
    font-family: inter, Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
a:hover, a:visited, a:link, a:active
{
    text-decoration: none;
}
/* ************************* */
/* App styles */
/* ************************* */
a { 
    color: lightskyblue;
}
 p > code, li > code {
    color: orange;
    background-color: rgb(42, 39, 52);;
    border-radius: 4px;
    padding: 5px;
    margin-right: 2px;
}
pre {
    border-radius: 4px;
    margin: 15px;
    overflow: scroll;
}
.token {
    font-family: Operator Mono A,Operator Mono B,Source Code Pro,Menlo,Consolas,Monaco,monospace !important;
    font-size: smaller;
    word-break: break-word;
    line-height: 32px;
    font-size: 21px;
    letter-spacing: -0.003em;
    margin-bottom: 1em;
    margin-top: .5em;
}
body {
    background-color: black;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6, p {
    color: white;
}
h1 {
    line-height: 48px;
    font-size: 40px;
    font-weight: 400;
}
h2 {
    font-weight: 600;
    letter-spacing: -0.022em;
    font-size: 26px;
    padding-top: 1.72em;
    margin-bottom: -0.31em;
}
p {
    word-break: break-word;
    line-height: 32px;
    font-size: 21px;
    letter-spacing: -0.003em;
    margin-bottom: 1em;
    margin-top: .5em;
}
p:last-of-type {
    margin-bottom: 200px;
}
q{
    margin: 5px;
    font-style: italic;
}
.content{
/*     padding-left: 19vw; */
    position: absolute;
    top: 70px;
    z-index: 1;
    max-width: 100vw;
}
.container {
    margin: 15px;
}

.container-sm{
    margin: 5px;
}

.container-lg {
    margin: 25px;
}
/* ************************* */
/* Blog Post Styles */
/* ************************* */
.blog-post-container {
    display: flex;
    flex-direction: column;
    justify-self: center;
    max-width: 60vw;
}
/* ************************* */
/* Navigation styles */
/* ************************* */
.nav-container {
    position: fixed;
    top: 0;
    width: 100vw;
    height: 50px;
    box-shadow:0 1px 0 rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.1);
    z-index: 2;
    overflow: hidden;
}
.nav {
    position: fixed;
    overflow: hidden;
    top: 0;
    width: 100vw;
    height: 50px;
    margin: 0px;
    z-index: 2;
    background: #5d5d5dff;
}
.nav-links-container {
    display: flex;
    flex-direction: row;
    list-style: none;
    margin-top: 10px;
    margin-left: 25px;
    position: fixed;
    top: 0px;
    z-index: 4;
}
.nav-link {
    margin-right: 25px;
}
.nav-link > a {
    color: white;
}
.link-container {
    margin-top: 0px;
    padding: 5px;
    border-radius: 4px;
    transition: all ease-in-out .2s;
    background-color: transparent;
}
.link-container:hover {
    background-color: #969696b2;
    cursor: pointer;
}
.link-container > .link {
    color: white;
}
.article-list {
    border-left: 5px solid white;
}
.article-list > li {
    margin: 10px;
    font-size: larger;
}
/* ************************* */
/* Blur styles */
/* ************************* */
@supports (backdrop-filter: blur(12px)) {
    .blurred {
        backdrop-filter: saturate(180%) blur(13px) ;
    }
    .nav {
        background-color: #5d5d5dc2;
    }
}
@supports not (backdrop-filter: blur(12px)) {
    .blurred-content {
        padding:0 1rem;
        padding-top: 22px;
        margin-left: -15px;
        position:absolute;
        top:0;
        left:0;
        right:0;
        filter:url(#blur-effect);
        opacity:0.3;
        z-index: 3;
        height: 50px;
    }
}
              
            
!

JS

              
                const NavBar = ({transparent}) => {
    React.useEffect(() => {
        if (!transparent) { return; }
        // adapted from this CodePen: https://codepen.io/sqlexception/pen/dnaCx
        const blurTarget = document.querySelector('.blur-target');
        const duplicate = blurTarget.cloneNode(true);
        const targetBlurred = document.createElement('div');
        targetBlurred.className = 'blurred-content';
        targetBlurred.appendChild(duplicate);

        const navContainer = document.querySelector('.nav-container');
        navContainer.appendChild(targetBlurred);

        const contentWrapper = document.querySelector('#content')
        window.addEventListener('scroll', function () {
            duplicate.style.marginTop = -this.scrollY + 'px';
        });
    }, [transparent])
    return (
        <div className="navbar">
            <ul className="nav-links-container">
                <li className="nav-link">
                    <a href="/">
                        <div className="link-container">
                            <a className="link" style={{ fontSize: 'larger' }}>Home</a>
                        </div>
                    </a>
                </li>
                <li className="nav-link">
                    <a href="/blog">
                        <div className="link-container">
                            <a className="link" style={{ fontSize: 'larger' }}>Blog</a>
                        </div>
                    </a>
                </li>
            </ul>
            <div className="nav blurred">
            </div>
        </div>
    )
};

class HelloWorld extends React.Component {
  render() {
    // Tells React what HTML code to render
    return (
      <>
        <div class="nav-container">
          <NavBar transparent/>
        </div>
        <div class= "container content blur-target" id="content" >
          <div class="blog-post-container" style={{height: 1000}}>
           <img width="400px" height="800px" src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.imgur.com%2FQGd4ejk.jpg&f=1&nofb=1" />
            </div>
        </div>
        <svg id="svg-image-blur">
            <filter id="blur-effect">
                <feGaussianBlur stdDeviation="10" />
            </filter>
        </svg>
      </>
    )
  }
};

// Tells React to attach the HelloWorld component to the 'root' HTML div
ReactDOM.render(<HelloWorld />, document.getElementById("root"))

              
            
!
999px

Console