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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
#background
img(
src="//p2.music.126.net/LkwTIyU7Zo853W6LUfYpag==/109951167574776183.jpg"
alt="徐佳莹"
crossorigin="anonymous"
)
#navigation
.title Hello, 欢迎来到我的个人主页
#icon-box
a(
href="/"
title="主页"
class="current"
)
svg(
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
)
path(d="M951.467 425.956l-386.133-307.2c-29.867-23.467-76.8-23.467-106.667 0l-386.133 307.2c-8.533 6.4-10.667 21.333-4.267 29.867 6.4 8.533 21.333 10.667 29.867 4.267l386.133-309.333c14.933-10.667 40.533-10.667 53.333 0l386.133 307.2c6.4 4.267 10.667 4.267 14.933 4.267 6.4 0 12.8-2.133 17.067-8.533 6.4-8.533 6.4-21.333-4.267-27.733zM874.667 504.889c-12.8 0-21.333 8.533-21.333 21.333v311.467c0 19.2-8.533 29.867-27.733 29.867h-204.8v-132.267c0-57.6-46.933-102.4-104.533-102.4h-4.267c-57.6 0-104.533 46.933-104.533 102.4v132.267h-204.8c-19.2 0-32-10.667-32-29.867v-311.467c0-12.8-8.533-21.333-21.333-21.333s-21.333 8.533-21.333 21.333v311.467c0 42.667 32 72.533 74.667 72.533h226.133c12.8 0 21.333-8.533 21.333-21.333v-153.6c0-32 27.733-59.733 61.867-59.733h4.267c34.133 0 61.867 27.733 61.867 59.733v153.6c0 12.8 8.533 21.333 21.333 21.333h226.133c42.667 0 70.4-29.867 70.4-72.533v-311.467c0-10.667-8.533-21.333-21.333-21.333z")
span Home
a(
href="https://blog.200011.net"
title="博客"
target="_blank"
)
svg(
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
)
path(d="M919.84 314.912l-246.816-241.984C666.944 66.976 659.008 64 650.272 63.776c-8.512 0.096-16.64 3.552-22.56 9.632L168.512 543.808c-4.416 4.512-7.392 10.272-8.576 16.448L97.984 890.912C96 901.504 99.456 912.352 107.2 919.808c6.016 5.856 14.016 8.992 22.24 8.992 2.304 0 4.672-0.256 6.976-0.768l292.448-65.216c6.112-1.344 11.712-4.512 16.064-9.024l475.584-493.824C932.672 347.296 932.384 327.2 919.84 314.912zM433.792 773.088l-122.528-121.472c-12.576-12.48-32.864-12.384-45.248 0.192-12.448 12.576-12.352 32.8 0.192 45.248l112.384 111.392L169.824 855.04l51.264-273.472L651.136 141.088l201.248 197.312L433.792 773.088z")
span Blog
a(
href="https://blog.200011.net/about"
title="关于"
target="_blank"
)
svg(
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
)
path(d="M800 384c0-160-128-288-288-288s-288 128-288 288c0 108.8 57.6 201.6 147.2 249.6-121.6 48-214.4 153.6-240 288-3.2 16 6.4 35.2 25.6 38.4h6.4c16 0 28.8-9.6 32-25.6 28.8-150.4 160-259.2 313.6-262.4h6.4c156.8 0 284.8-128 284.8-288zM288 384c0-124.8 99.2-224 224-224s224 99.2 224 224c0 121.6-99.2 220.8-220.8 224H505.6C384 604.8 288 505.6 288 384zM723.2 675.2c-16-9.6-35.2-6.4-44.8 9.6-9.6 16-6.4 35.2 9.6 44.8 73.6 51.2 124.8 121.6 140.8 204.8 3.2 16 16 25.6 32 25.6h6.4c16-3.2 28.8-19.2 25.6-38.4-19.2-99.2-80-185.6-169.6-246.4z")
span About
a(
href="https://codepen.io/yoniu"
title="Codepen"
target="_blank"
)
svg(
class="icon"
viewBox="0 0 100 100"
)
path(d="M100 34.2c-.4-2.6-3.3-4-5.3-5.3-3.6-2.4-7.1-4.7-10.7-7.1-8.5-5.7-17.1-11.4-25.6-17.1-2-1.3-4-2.7-6-4-1.4-1-3.3-1-4.8 0-5.7 3.8-11.5 7.7-17.2 11.5L5.2 29C3 30.4.1 31.8 0 34.8c-.1 3.3 0 6.7 0 10v16c0 2.9-.6 6.3 2.1 8.1 6.4 4.4 12.9 8.6 19.4 12.9 8 5.3 16 10.7 24 16 2.2 1.5 4.4 3.1 7.1 1.3 2.3-1.5 4.5-3 6.8-4.5 8.9-5.9 17.8-11.9 26.7-17.8l9.9-6.6c.6-.4 1.3-.8 1.9-1.3 1.4-1 2-2.4 2-4.1V37.3c.1-1.1.2-2.1.1-3.1 0-.1 0 .2 0 0zM54.3 12.3L88 34.8 73 44.9 54.3 32.4V12.3zm-8.6 0v20L27.1 44.8 12 34.8l33.7-22.5zM8.6 42.8L19.3 50 8.6 57.2V42.8zm37.1 44.9L12 65.2l15-10.1 18.6 12.5v20.1zM50 60.2L34.8 50 50 39.8 65.2 50 50 60.2zm4.3 27.5v-20l18.6-12.5 15 10.1-33.6 22.4zm37.1-30.5L80.7 50l10.8-7.2-.1 14.4z")
span Codepen
a(
href="https://github.com/yoniu"
title="Github"
target="_blank"
)
svg(
class="icon"
viewBox="0 0 16 16"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
)
path(d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z")
span Github
#friends
.friends-title 友情链接
.friends-list
a(
href="https://www.sunjianjian.com/"
title="总会有温柔的人愿意站在你能看见的地方。"
target="_blank"
) Sun's Blog
a(
href="https://q6q.cc/"
title="强仔博客记录美好生活"
target="_blank"
) 强仔爱啦
a(
href=""
title=""
target="_blank"
) 胡家小子
a(
href="https://www.boyhu.cn"
title="记录对生活的向往,记录生活周遭的个人网站。"
target="_blank"
)
a(
href="https://usj.cc"
title="记录美好生活与不平凡的你"
target="_blank"
) 优世界
a(
href="https://blog.u82.cc/"
title="努力,上进,不负野心"
target="_blank"
) 尤且’s 小栈
a(
href="https://sumiler.com"
title="微风轻轻起 夏日不再来。高中生九日的个人博客,用于记录生活的点点滴滴,同时写下自己的人生故事及内心思想"
target="_blank"
) 微风忆夏
a(
href="https://osgz.com/"
title="一个沙雕的同学"
target="_blank"
) 萧同学
a(
href="https://beifeng.me/"
title="记录着自己的生活时光"
target="_blank"
) 北枫
a(
href="https://www.c0smx.com/"
title="c0sMx's Blog"
target="_blank"
) c0sMx's Blog
a(
href="https://keepke.com/"
title="保持思考与理性"
target="_blank"
) 吾柯
a(
href="https://blog.truimo.com/"
title="梦也有难过的时候,生活也是"
target="_blank"
) 浅小沫
a(
href="https://blog.fateso.com"
title="日常生活即是颂歌."
target="_blank"
) XUHENG
#footer
.copyright
p Powered by
a(
href="https://codepen.io/yoniu/pen/yLKZWoV"
title="本站源码"
target="_blank"
rel="noopener nofollow"
) 油油
| .
a(
href="https://beian.miit.gov.cn/"
title="备案查询"
rel="noopener nofollow"
target="_blank"
) 粤ICP备18152975号
@media screen and (max-width: 600px) {
.title {
font-size: 1.6rem!important;
}
#icon-box {
svg {
font-size: 1.6rem!important;
}
}
}
body {
position: relative;
margin: 0 auto;
padding: 0;
box-sizing: content-box;
color: white;
font-size: 16px;
}
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
#background {
position: fixed;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-image: linear-gradient(45deg, var(--defColor0), var(--defColor1));
overflow: hidden;
z-index: -1;
img {
position: relative;
max-height: 100vh;
min-height: 100vh;
filter: blur(20px);
}
}
#navigation {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100vw;
height: 100vh;
z-index: 1;
.title {
font-size: 2.4rem;
font-weight: bold;
letter-spacing: 1.8px;
margin: 1rem 1rem 3rem;
text-align: center;
}
#friends {
width: 90%;
min-width: 300px;
max-width: 640px;
margin: 2rem 0 1rem;
.friends-title {
display: inline-block;
font-size: 1.3rem;
font-weight: bold;
box-shadow: inset 0 -14px 0 0 darken(pink, 10%);
margin-bottom: .5rem;
}
.friends-list {
display: flex;
align-items: center;
flex-wrap: wrap;
a {
flex-shrink: 0;
margin-bottom: 5px;
color: white;
text-decoration: none;
transition: .3s ease-in-out all;
&:not(:last-child) {
margin-right: 1rem;
}
&:hover {
text-decoration: underline dotted pink;
}
}
}
}
#icon-box {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-auto-flow: column dense;
grid-row-gap: 1rem;
grid-column-gap: 1rem;
width: 90%;
min-width: 300px;
max-width: 640px;
a{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
color: white;
background-color: rgba(255, 255, 255, .2);
border: 1px solid rgba(255, 255, 255, .25);
border-radius: 10px;
height: calc(var(--height) * (3 / 4));
text-decoration: none;
transition: .3s ease-in-out all;
svg{
font-size: 2.5rem;
margin-bottom: .5rem;
}
span {
font-size: .9rem;
}
&.current {
grid-row: 1/span 2;
height: unset;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
background-color: rgba(255, 255, 255, .35);
}
}
}
#footer {
font-size: .9rem;
a {
color: white;
text-decoration: underline dotted pink;
&:hover {
color: pink;
}
}
}
}
const colorThief = new ColorThief(),
img = document.querySelector('#background img');
let defColor = [255,255,255];
if (img.complete) {
defColor = colorThief.getPalette(img);
} else {
img.addEventListener('load', function() {
defColor = colorThief.getColor(img);
});
}
document.body.style = `
--defColor0: rgb(${defColor[4]});
--defColor1: rgb(${defColor[2]});
`;
const aTags = document.querySelectorAll('#icon-box a');
for (let aTag of aTags) {
aTag.style = `--height: ${aTag.offsetWidth}px;`;
aTag.setAttribute('onmouseover', 'setHeight(this)');
}
function setHeight (element) {
document.querySelector('a.current').classList.remove('current');
element.classList.add('current');
}
Also see: Tab Triggers