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.
<!-- sonic font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@900&display=swap" rel="stylesheet">
<div class="container">
<h1 class="sonic-text">HASHNODE</h1>
<div class="ground">
<div class="grass-ground"></div>
<div class="ground-squares"></div>
</div>
<div class="hashnode-big-box">
<div class="monitor">
<div class="screen">
<div class="monitor-ring"></div>
</div>
<div class="line-one"></div>
<div class="line-two"></div>
</div>
<div class="grass-box"></div>
<div class="hashnode-big"></div>
<div class="rings">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="flower">
<div class="stem">
<div class="circle-part"></div>
</div>
<div class="yellow-parts">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="leaf">
<span></span>
<span></span>
</div>
</div>
<div class="sonic">
<div class="head">
<div class="head-top"></div>
<div class="left-eye"></div>
<div class="right-eye"></div>
<div class="middle"></div>
</div>
<div class="hair">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="left-ear"></div>
<div class="right-ear"></div>
<div class="nose"></div>
<div class="mouth"></div>
<div class="body"></div>
<div class="left-hand"></div>
<div class="right-hand"></div>
<div class="left-leg">
<div class="sock"></div>
<div class="shoe"></div>
<div class="shoe-two"></div>
</div>
<div class="right-leg">
<div class="sock"></div>
<div class="shoe"></div>
<div class="shoe-two"></div>
</div>
</div>
</div>
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html {
// font-family: lato;
font-family: 'Prompt', sans-serif;
font-size: 62.5%;
}
// ***** COLORS
$transparent: rgba(255, 255, 255, 0);
$hashnode: #285ff7;
$sonic-text: #0041d1;
$sonic-text-border: #febf3e;
$soni-text-white: #ebf1ff;
$light-green: #6eda11;
$dark-green: #006d00;
$dark-olive: #436743;
$gold: #f3e715;
$ring: #eec708;
$light-gray: #dedbda;
$dark-brown: #601b01;
$light-brown: #ba5400;
$silver: #879590;
$crimson: #f6153b;
// ********
// **** MIXINS
@mixin basics($w, $h, $color) {
width: $w;
height: $h;
background: $color;
}
@mixin position($top, $left) {
position: absolute;
top: $top;
left: $left;
}
// hashonode logo
@mixin hashnode($width) {
width: $width;
aspect-ratio: 1;
position: absolute;
border-radius: 27%;
background: $hashnode;
// -webkit-mask: radial-gradient(#0000 58%, #000 58%);
// mask: radial-gradient(#0000 88%, #000 88.25%);
/* for demo, centering it on the page */
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
}
// gold ring
@mixin ring {
border-radius: 50%;
border: solid $ring 5px;
display: block;
}
@mixin center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
// flower's yellow part
@mixin yellow-flower {
border-bottom: 3rem solid $gold;
border-left: 1.5rem solid $transparent;
border-right: 1.5rem solid $transparent;
}
// *********************************
// *********************************
body {
// @include basics(100%, 100vh,$light-gray );
width: 100%;
height: 100%;
position: fixed;
background-image: linear-gradient((rgba(0, 0, 0, 0.531), rgba(0, 0, 0, 0.49))), url(https://external-preview.redd.it/fhkU2h_KoqELvDHZPjgjaSnD_dJjnDVj3qE0-b7Ih3g.jpg?width=640&crop=smart&auto=webp&s=6cb956fffbe9459c67237f6716132c708291d5df);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
// sonic text
.sonic-text {
// centering the header box
width: 28rem;
margin: 0 auto;
// centering the text
display: flex;
justify-content: center;
// border: solid red 5px;
// styling the text
color: $sonic-text;
font-size: 6rem;
letter-spacing: 7px;
// *******************
// -webkit-text-fill-color: $sonic-text;
// -webkit-text-stroke-color: $gold;
// -webkit-text-stroke-width: 5px;
// **** sonic text border
text-shadow: 3px 3px 0 $gold, -3px 3px 0 $gold, 3px -3px 0 $gold, -3px -3px 0 $gold, 0px 3px 0 $gold, 0px -3px 0 $gold, -3px 0px 0 $gold, 3px 0px 0 $gold, 5px 5px 0 $gold, -5px 5px 0 $gold, 5px -5px 0 $gold, -5px -5px 0 $gold, 0px 5px 0 $gold, 0px -5px 0 $gold, -5px 0px 0 $gold, 5px 0px 0 $gold, 3px 5px 0 $gold, -3px 5px 0 $gold, 3px -5px 0 $gold, -3px -5px 0 $gold, 5px 3px 0 $gold, -5px 3px 0 $gold, 5px -3px 0 $gold, -3px 3px 0 $gold, 3px -3px 0 $gold, -3px -3px 0 $gold, 0px 3px 0 $gold, 0px -3px 0 $gold, -3px 0px 0 $gold, 3px 0px 0 $gold, 5px 5px 0 $gold, -5px 5px 0 $gold, -5px -3px 0 $gold, 7px 7px 0 $soni-text-white, -7px 7px 0 $soni-text-white, 7px -7px 0 $soni-text-white, -7px -7px 0 $soni-text-white, 0px 7px 0 $soni-text-white, 0px -7px 0 $soni-text-white, -7px 0px 0 $soni-text-white, 7px 0px 0 $soni-text-white, 9px 9px 0 $soni-text-white, -9px 9px 0 $soni-text-white, 9px -9px 0 $soni-text-white, -9px -9px 0 $soni-text-white, 0px 9px 0 $soni-text-white, 0px -9px 0 $soni-text-white, -9px 0px 0 $soni-text-white, 9px 0px 0 $soni-text-white, 7px 9px 0 $soni-text-white, -7px 9px 0 $soni-text-white, 7px -9px 0 $soni-text-white, -7px -9px 0 $soni-text-white, 9px 7px 0 $soni-text-white, -9px 7px 0 $soni-text-white, 9px -7px 0 $soni-text-white, -7px 7px 0 $soni-text-white, 7px -7px 0 $soni-text-white, -7px -7px 0 $soni-text-white, 0px 7px 0 $soni-text-white, 0px -7px 0 $soni-text-white, -7px 0px 0 $soni-text-white, 7px 0px 0 $soni-text-white, 9px 9px 0 $soni-text-white, -9px 9px 0 $soni-text-white, -9px -7px 0 $soni-text-white;
}
.ground {
// position: absolute;
width: 100%;
height: 9rem;
position: absolute;
bottom: 0;
background: conic-gradient($light-brown 25%, $dark-brown 0 50%, $light-brown 0 75%, $dark-brown 0) 0 0 / 10vmin 10vmin;
// first row
.grass-ground {
width: 100%;
height: 2rem;
position: absolute;
bottom: 9rem;
background: conic-gradient($light-green 25%, $dark-green 0 50%, $light-green 0 75%, $dark-green 0) 0 0 / 6vmin 12vmin;
}
}
.hashnode-big-box {
@include basics(45rem, 50rem, $transparent);
margin: 2rem auto 0 auto;
// border: solid green 5px;
position: relative;
// *****Monitor
.monitor {
@include basics(15rem, 10rem, $transparent);
margin: 0 auto;
padding-bottom: 2rem;
// border: solid green 5px;
position: relative;
// centering
display: flex;
align-items: center;
justify-content: center;
// black screen
.screen {
@include basics(5rem, 5rem, black);
border-radius: 20%;
position: relative;
// silver border around the monitor
&::before {
content: "";
display: block;
@include basics(125%, 125%, $silver);
border-radius: 10%;
z-index: -1;
position: absolute;
left: -.6rem;
top: -.6rem;
}
// gold border inside of the monitor
&::after {
content: "";
display: block;
@include basics(78%, 78%, $transparent);
border: solid $ring 3.5px;
border-radius: 20%;
@include center;
}
.monitor-ring {
// @include basics(2rem,2rem , $transparent );
// @include position(0,0 );
// z-index: 5;
// @include ring;
// @include center;
@include hashnode(2rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $ring
}
}
.line-one {
@include basics(.8rem, 1.2rem, $silver);
@include position(6.8rem, 6.9rem);
border: solid black .5px;
}
.line-two {
@include basics(.6rem, 6.5rem, $silver);
@include position(4.9rem, 7rem);
border: solid black .5px;
transform: rotate(90deg);
}
}
// ******
.grass-box {
width: 28rem;
height: 2rem;
// border: solid $transparent 5px;
@include position(8.5rem, 8rem);
z-index: 2;
position: absolute;
border-radius: 22% 22% 0 0;
background: conic-gradient($light-green 25%, $dark-green 0 50%, $light-green 0 75%, $dark-green 0) 0 0 / 3vmin 12vmin;
}
// ********
.hashnode-big {
@include hashnode(39rem);
-webkit-mask: radial-gradient(#0000 58%, #000 58%);
transform: rotate(0);
// border: solid red 5px;
@include position(9rem, 2.5rem);
}
// gold ring *****
.rings {
span {
&:nth-child(6) {
// @include ring;
// @include basics(3rem,3rem, $transparent);
@include hashnode(2.5rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $gold;
@include position(26rem, 7.8rem);
}
&:nth-child(2) {
// @include ring;
// @include basics(3rem,3rem, $transparent);
@include hashnode(2.5rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $gold;
@include position(17.5rem, 12rem);
}
&:nth-child(3) {
// @include ring;
// @include basics(3rem,3rem, $transparent);
@include hashnode(2.5rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $gold;
@include position(14rem, 22rem);
}
&:nth-child(4) {
// @include ring;
// @include basics(3rem,3rem, $transparent);
@include hashnode(2.5rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $gold;
@include position(17.5rem, 32rem);
}
&:nth-child(5) {
// @include ring;
// @include basics(3rem,3rem, $transparent);
@include hashnode(2.5rem);
-webkit-mask: radial-gradient(#0000 40%, #000 40%);
background: $gold;
@include position(27rem, 36.3rem);
}
}
}
}
.flower {
// border: solid red 2px;
@include basics(17rem, 28rem, $transparent);
@include position(33rem, 106rem);
z-index: 1;
// ****
.stem {
@include basics(1.7rem, 17rem, $light-green);
position: absolute;
bottom: 0;
left: 7rem;
border-radius: 15%;
border: solid $dark-green 2px;
}
// ****
.circle-part {
@include basics(6rem, 6rem, $dark-olive);
border-radius: 50%;
@include position(-1rem, -2.3rem);
&::before {
content: "";
display: block;
@include basics(5rem, 5rem, $transparent);
box-shadow: 3px 2px .1px .1px rgba($light-gray, .5);
border-radius: 50%;
transform: rotate(190deg);
@include position(.8rem, .7rem);
}
}
.yellow-parts {
span {
&:nth-child(1) {
@include yellow-flower;
@include position(7.3rem, 6.3rem);
z-index: -1;
}
// **************
// FIX THE INDEX-Z UUGGGHHH
// ***************
&:nth-child(2) {
@include yellow-flower;
@include position(15rem, 6.3rem);
transform: scaleY(-1);
z-index: 2;
}
&:nth-child(3) {
@include yellow-flower;
@include position(9rem, 9.8rem);
z-index: -1;
transform: rotate(55deg);
}
&:nth-child(4) {
@include yellow-flower;
@include position(13rem, 9.8rem);
z-index: -1;
transform: rotate(120deg);
}
&:nth-child(5) {
@include yellow-flower;
@include position(9.2rem, 3rem);
z-index: -1;
transform: rotate(120deg) scaleY(-1);
}
&:nth-child(6) {
@include yellow-flower;
@include position(13.2rem, 3rem);
z-index: -1;
transform: rotate(55deg) scaleY(-1);
}
}
}
.leaf {
span {
z-index: -1;
&:nth-child(1) {
@include basics(3rem, 4.5rem, $light-green);
border-radius: 100% 0 100% 0;
@include position(17rem, 8rem);
border: solid 3px $dark-green;
}
&:nth-child(2) {
@include basics(3rem, 4.5rem, $light-green);
border-radius: 0 100% 0 100%;
@include position(19rem, 5rem);
border: solid 3px $dark-green;
}
}
}
}
.sonic {
@include basics(30rem, 31rem, $transparent);
// border: solid red 3px;
position: absolute;
bottom: 6rem;
left: 13rem;
// ***** heade
.head {
@include basics(10rem, 10rem, $hashnode);
border-radius: 50%;
border: solid black 1px;
.head-top {
@include basics(5rem, 5rem, $hashnode);
transform: rotate(45deg);
@include position(-.4rem, 2.5rem);
border-radius: 20%;
}
// eyes
.left-eye {
@include basics(3rem, 6rem, #d0ced9);
border-radius: 40%;
@include position(2rem, 1.3rem);
transform: rotate(-10deg);
&::before {
content: "";
display: block;
@include basics(1.3rem, 2.3rem, black);
border-radius: 40%;
@include position(1.5rem, .9rem);
}
}
.right-eye {
@extend .left-eye;
@include position(2rem, 5.3rem);
transform: rotate(10deg);
}
.middle {
@include basics(3rem, 2rem, #d0ced9);
@include position(6rem, 3.3rem);
}
}
.hair {
span {
&:nth-child(1) {
@include basics(5rem, 5rem, $transparent);
box-shadow: 1.5rem 1.5rem .1px .1px $hashnode;
position: absolute;
border-radius: 50%;
transform: rotate(200deg);
@include position(3.9rem, -.6rem);
z-index: -5;
}
&:nth-child(2) {
@include basics(5rem, 5rem, $transparent);
box-shadow: 1.5rem 1.5rem .1px .1px $hashnode;
position: absolute;
border-radius: 50%;
transform: rotate(-100deg);
@include position(3.9rem, 5.5rem);
z-index: -5;
}
&:nth-child(3) {
@include basics(6rem, 6rem, $transparent);
box-shadow: 2.5rem 1.8rem .1px .1px $hashnode;
position: absolute;
border-radius: 50%;
transform: rotate(220deg);
@include position(9rem, -1rem);
z-index: -5;
}
&:nth-child(4) {
@include basics(6rem, 6rem, $transparent);
box-shadow: 2.5rem 1.8rem .1px .1px $hashnode;
position: absolute;
border-radius: 50%;
transform: rotate(-220deg) scaleX(-1);
@include position(9rem, 5.2rem);
z-index: -5;
}
}
}
.left-ear {
border-bottom: 3.8rem solid $hashnode;
border-left: 2rem solid $transparent;
border-right: 2rem solid $transparent;
@include position(-2rem, -.6rem);
transform: rotate(-30deg);
&::before {
content: "";
display: block;
border-bottom: 2rem solid #d0ced9;
border-left: 1rem solid $transparent;
border-right: 1rem solid $transparent;
@include position(1rem, -1rem);
}
}
.right-ear {
@extend .left-ear;
transform: scaleX(-1) rotate(-30deg);
@include position(-2rem, 6.6rem);
}
.nose {
@include basics(1rem, 1.5rem, black);
@include position(6rem, 4.2rem);
border-radius: 40%;
z-index: 1;
}
.mouth {
@include basics(8rem, 3rem, #bb935f);
@include position(7rem, 1rem);
border-radius: 40%;
}
.body {
@include basics(12rem, 12rem, $hashnode);
border-radius: 30%;
border: solid 3px rgba(0, 0, 0, 0.544);
transform: rotate(45deg);
z-index: -1;
@include position(8.5rem, -.7rem);
&::before {
content: "";
display: block;
@include basics(45%, 45%, #eee);
border-radius: 50%;
@include center;
}
}
.left-hand {
@include basics(1.8rem, 9rem, $hashnode);
@include position(8rem, -2.5rem);
border: solid 1px rgba(0, 0, 0, 0.544);
transform: rotate(55deg);
z-index: -2;
&::before {
content: "";
display: block;
@include basics(1.8rem, 9rem, $hashnode);
border: solid 1px rgba(0, 0, 0, 0.544);
transform: rotate(55deg) translate(3rem, -2rem);
}
}
.right-hand {
@include basics(1.8rem, 9rem, $hashnode);
@include position(8rem, 11rem);
border: solid 1px rgba(0, 0, 0, 0.544);
transform: rotate(-55deg);
z-index: -2;
&::before {
content: "";
display: block;
@include basics(3.3rem, 2.8rem, #eee);
border-radius: 35%;
@include position(8rem, -1rem);
}
}
.left-leg {
@include basics(2rem, 12rem, $hashnode);
@include position(17rem, 1.5rem);
.sock {
@include basics(4.5rem, 2.7rem, #eee);
border-radius: 20%;
@include position(10rem, -1.3rem);
border: solid 2px rgba(0, 0, 0, 0.748);
}
.shoe {
@include basics(3.5rem, 2.7rem, $crimson);
border-radius: 20%;
@include position(12rem, -.8rem);
overflow: hidden;
&::before {
content: "";
display: block;
@include basics(2.5rem, 5rem, #eee);
// transform: rotate(20deg);
@include position(-.2rem, -.8rem);
border: solid 2px rgba(0, 0, 0, 0.748);
}
}
.shoe-two {
border-bottom: solid $crimson 2.8rem;
border-left: solid $transparent 3.2rem;
@include position(2rem, -.8rem);
@include position(12rem, -3.5rem);
}
}
.right-leg {
@extend .left-leg;
transform: scaleX(-1);
@include position(17rem, 7rem);
}
}
Also see: Tab Triggers