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 URL's 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 it's URL and the proper URL extention.
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.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Traval</title>
</head>
<body>
<main id="main-doc">
<section class="main-section" id="Bei_Jing">
<header>
Bei Jing
</header>
<p>Bei Jing is the Capital of China, this is a large city.</p>
<p>There are more than 20 millions people live there.</p>
<p>There are so many parks and museums, on weekends and holidays always are so many people.</p>
<div id="code1">
<p><code>h1 {
font-size: 40px;
}</code></p>
</div>
<ul>
<li>Tian an men</li>
<li>Gu gong</li>
<li>Yi he yuan</li>
<li>Tian tan</li>
</ul>
</section>
<section class="main-section" id="Shang_Hai">
<header>
Shang Hai
</header>
<p>Shand Hai is the Second famous city in China.</p>
<p>There are more than 20 millions people live there.</p>
<p>There are so many parks and museums, on weekends and holidays always are so many people.</p>
<div id="code2">
<p><code>const sec = 60;</code></p>
</div>
<ul>
<li>Cheng huang miao</li>
<li>Dong fang ming zhu</li>
<li>Wai tan</li>
</ul>
</section>
<section class="main-section" id="Guang_Zhou">
<header>
Guang Zhou
</header>
<p>Guang Zhou is the Third famous city in China.</p>
<p>There are more than 20 millions people live there.</p>
<p>There are so many parks and museums, on weekends and holidays always are so many people.</p>
</section>
<section class="main-section" id="Shen_Zhen">
<header>
Shen Zhen
</header>
<p>Shen Zhen is the Forth famous city in China, but it is really a very beautiful city.</p>
<ol>
<li>Window of the World</li>
<li>Happy harbour</li>
<li>Children's park</li>
<li>Sea of the world</li>
<li>Hong shu lin</li>
<li>Wongtee plaza</li>
<li>Lian hua shan</li>
</ol>
<p>There are the same more than 20 miliions people there, and it's very hot in summer, people like to go to the beach in summer.</p>
<p>Every weekends and holidays so many people they go to parks and beaches, they really enjoy that. </p>
<div id="code3">
<p><code>let yearsAlive = 80;</code></p>
</div>
</section>
<section class="main-section" id="Da_Lian">
<header>
Da Lian
</header>
<p>Da Lian is a city in the north, it's also a coastal city.</p>
<p>There are around 8 millions people there.</p>
<p>In summer so many people come there and enjoy the sunshine and seafood.</p>
<ul>
<li>Zoo</li>
<li>Xing hai plaza</li>
<li>Lao dong park</li>
</ul>
<div id="code4">
<p><code>const X = prompt('Please type a X.');</code></p>
</div>
</section>
<section class="main-section" id="Chang_Chun">
<header>
Chang Chun
</header>
<p>Chang Chun is the captital of JiLin in the northeast of China.</p>
<p>In winter so many people come here and enjoy snow, also so many people they come to ski.</p>
<p>People here are very open , they like to make friends and they like drinking.</p>
</section>
<section class="main-section" id="Nan_Jing">
<header>
Nan Jing
</header>
<p>Nan Jing is an old city, there are so many old Chinese culture here.</p>
<p>There are more than 10 miliions people live here.</p>
<p>Foods in Nan Jing is very delicious very light and nice, a lot of people they like the foods.</p>
<ol>
<li>Gui hua gao</li>
<li>Gui hua lian ou</li>
<li>Yan shui ya</li>
<li>Ya xie fen si tang</li>
</ol>
<div id="code5">
<p><code>img {
width: 100%;
}</code></p>
</div>
</section>
<section class="main-section" id="Shen_Yang">
<header>
Shen Yang
</header>
<p>Shen Yang is an old city, it's also cold in winter.</p>
<p>There are more than 7 miliions people there.</p>
<p>Foods in Shen Yang is very yummy, tasty and nice.</p>
<div id="code6">
<p><code><h2>Happy to see you</h2></code></p>
</div>
<ol>
<li>SY Gu gong</li>
<li>Guai po</li>
<li>Zhong jie</li>
</ol>
</section>
</main>
<nav id="navbar">
<header class="title">China Travel</header>
<hr>
<ul class="nav-L">
<li><a class="nav-link" href="#Bei_Jing">Bei Jing</a><br></li>
<hr>
<li><a class="nav-link" href="#Shang_Hai">Shang Hai</a><br></li>
<hr>
<li><a class="nav-link" href="#Guang_Zhou">Guang Zhou</a><br></li>
<hr>
<li><a class="nav-link" href="#Shen_Zhen">Shen Zhen</a><br></li>
<hr>
<li><a class="nav-link" href="#Da_Lian">Da Lian</a><br></li>
<hr>
<li><a class="nav-link" href="#Chang_Chun">Chang Chun</a><br></li>
<hr>
<li><a class="nav-link" href="#Nan_Jing">Nan Jing</a><br></li>
<hr>
<li><a class="nav-link" href="#Shen_Yang">Shen Yang</a><br></li>
</ul>
</nav>
</body>
</html>
body {
background-color: #ffe4c4;
}
header{
font-size: 30px;
font-weight: bold;
}
p {
font-size: 20px;
}
ul {
list-style-type: circle;
}
hr {
width: 100%;
}
#main-doc {
margin: 0 300px;
float: right;
}
#code1,
#code2,
#code3,
#code4,
#code5,
#code6 {
background-color: lightgrey;
padding: 5px;
width: 60%;
margin-left: 0px;
}
#navbar {
float: left;
position: fixed;
border-right: 2px solid black;
width: 260px;
margin: 0;
color: green;
}
ul.nav-L {
list-style-type: none;
border-bottom: 2px solid black;
text-align: center;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
.nav-link{
color: black;
text-decoration: none;
padding: 30px 17px;
font-size: 25px;
font-weight: normal;
text-align: center;
}
.title {
font-size: 40px;
padding-top: 20px;
}
@media only screen and (max-width: 480px) {
nav a {
float: right;
width: 20%;
margin: 0 0 0 5%;
padding: 25px 0;
margin-bottom: 0;
}
#main-doc {
width: 80%;
}
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
Also see: Tab Triggers