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.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>navbar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0-12/css/all.min.css">
<link rel="stylesheet" href="css/all.css">
</head>
<body>
<div class="navbar">
<div class="container">
<div class="logo">
<a href="#">
<i class="fas fa-music"></i>MusicIsGood
</a>
</div>
<ul class="menu">
<li><a href="#" target="_blank">華語</a></li>
<li><a href="#" target="_blank">西洋</a></li>
<li><a href="#" target="_blank">東洋</a></li>
<li><a href="#" target="_blank">鄉村</a></li>
</ul>
</div>
<!-- <div class="clearfix"></div> -->
</div>
<!-- navbar end -->
<div class="header">
<div class="container">
<div class="text-area">
<div class="text">
<h1 class="title">
永垂不朽的鐵人經典
</h1>
</div>
</div>
</div>
</div>
<!-- header end -->
<section1>
<div class="content">
<div class="container">
<ul>
<li>
<h2>本週主打星</h2>
<img
src="https://images.unsplash.com/photo-1474752651386-dc296d69dc90?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80">
<p>
嚴格海外你知道不可以,水平指揮軟件執行時間這個流行依法事實上常常當前,她的威望如下上傳詢問改,更新用來情感動漫才是引,之後感興趣取得足夠加上遼寧,印象他對失望壓力看著包裝每個人,天天自從騎士引用手冊周圍期待進一步電話提前很久簡介測試運,某個一口氣採取家裡還沒有確認正確高效。<br>
<a href="#">(繼續閱讀...)</a>
</p>
</li>
<li>
<h2>本週排行</h2>
<img
src="https://images.unsplash.com/photo-1483412033650-1015ddeb83d1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1353&q=80">
<p>
我市維護不對星座損失思路擴大教,經理不用研究所接口股權不斷有,添加對此水平供求實在發現無疑研究生來看一件他也總體儘量及其德,由於習慣就在還可以因而受到時,等級上帝聽說權益追求新,下了西方因素熱線下降節省差不多藥物宣,也沒考察不可能肯定犯罪鼓勵時候依舊原來有,重大本類一份讓他印象身影進入資,先進高中。<br>
<a href="#">(繼續閱讀...)</a>
</p>
</li>
<li>
<h2>本週冠軍歌曲</h2>
<img
src="https://images.unsplash.com/5/unsplash-kitsune-4.jpg?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80">
<p>
對待環保訓練程度條件太陽手,創意現象統一您可以觀看便是,一下子自然太陽考生每次權利一段時間立刻反映全身男女極,在此先生有很多轉貼處罰缺乏溫度操作攻擊,自由聯繫方式海外如今是以請您地圖可能會經銷商少,職工請大家是怎麼極大流行上升來,開發近年來通道市民品種開口天然考研歐洲,醫藥長大能量開關整合列表消息上。<br>
<a href="#">(繼續閱讀...)</a>
</p>
</li>
</ul>
</div>
</div>
</section1>
</body>
</html>
*{
box-sizing:border-box}
p{
color: #333;
line-height: 1.5;
}
$lead-color:#ffc078;
.navbar{
background-color: #333;
height: 50px;
}
.container{
width: 1024px;
margin: 0 auto;
}
.logo{
display:inline;
a{
color:$lead-color;
margin-top: 1em;
margin-bottom: 1em;
text-decoration: none;
line-height:50px;
font-size: 24px;
}
.fa-music{
color:$lead-color;
margin-right: 1em;
}
}
.menu{
float:right;
li{
float:left;
}
a{
display:flex;
margin-right: 10px;
color:$lead-color;
text-decoration: none;
line-height:50px;
padding: 0 1em;
}
a:hover{
background-color: $lead-color;
color:#333
}
}
.header{
background-image: url(https://images.unsplash.com/photo-1470229722913-7c0e2dbbafd3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80);
max-width:100%;
height: 420px;
background-repeat: no-repeat;
background-size:cover;
background-position: center center;
.text{
text-align:center;
}
}
.text-area{
padding-top: 150px;
}
.text{
margin:0 auto;
color:#fff;
background-color: #000;
opacity:0.6;
padding:2em;
.title{
font-size:50px;
font-weight: bold;
}
}
.content{
margin-top: 20px;
h2{
font-size:24px;
color: $lead-color;
margin-bottom: 1em;
font-weight: bold;
text-align: center;
}
li{
width: 31.33333%;
margin-right: 1%;
margin-left: 1%;
margin-bottom: 1em;
float: left;
}
img{
max-width: 100%;
height: auto;
margin-bottom: 1em;
}
a{
text-decoration: none;
color: blue;
}
}
Also see: Tab Triggers