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>
<main id="main">
<h1 id="title">
M.S DHONI
</h1>
<div id="img-div">
<img id="image"
src="https://cdn.dnaindia.com/sites/default/files/styles/full/public/2019/07/23/851289-ms-dhoni-1-afp.jpg" alt="m.s dhoni">
<div id="img-caption">
MAHENDRA SINGH DHONI
</div>
</div>
<div id="tribute-info">
<h2>Top 10 achievements of MS Dhoni</h2>
<ul>
<li>
MS Dhoni is the only Indian captain who has led India to all three major ICC events. From winning the maiden T20 World Cup in 2007 on his captaincy debut to lead India to a World Cup victory on home soil in 2011. In 2013 he has won the Champions Trophy.
</li><hr>
<li>
Under his captaincy, India holds the numero uno position in Test ranking for 18 months.
</li><hr>
<li>MS Dhoni is the only non-Australian captain who has led his team more than 100 matches. He is also the third captain to have won the 100 matches after two Australian captains after Ricky Ponting and Allan Border.</li><hr>
<li> Dhoni is the fourth fastest batsman who has completed 8000 runs in New Zealand fifth and final match.</li><hr>
<li>In 2013 Champions Trophy Dhoni has won the Champions Trophy which made Dhoni have all three ICC trophies in his kitty. In the Champions Trophy India was the only team who were unbeaten. In the final, India defeated England by 5 runs.</li><hr>
<li>On November 1, 2011, the Indian Territorial Army conferred with honorary rank Lieutenant Colonel to Dhoni after which Dhoni has become the only captain after Kapil Dev to receive this prestigious award.</li><hr>
<li>2008 and 2009 Dhoni was awarded the ICC Player of the Year trophy.</li><hr>
<li>In 2011, 2012 and 2013 under Dhoni captaincy, India was named as ICC team of the year.</li><hr>
<li>Dhoni has won the Rajiv Gandhi Khel Ratna award in 2007.</li><hr>
<li> 2011 CNN-IBN Indian of the Year in Sports.</li><hr>
</ul>
<h4>
To learn more about this Legend click to his
<a
id="tribute-link"
href="https://en.wikipedia.org/wiki/MS_Dhoni"
target="_blank"
>Wikipedia entry</a
>.
</h4>
</div>
</main>
html
{
font-size: 10px ;
}
body
{
font-family: cursive;
background-color: #b0c4de;
text-align: center ;
font-size: 2rem;
line-height:1.4;
margin:0;
}
h1
{
font-size:3em;
margin-bottom:0;
}
@media (max-width:450px)
{
h1
{
font-size:2.7rem;
line-height:1.3;
}
}
h2
{
font-size:2.5em
}
#main
{
margin:35px 8px;
padding: 10px;
}
@media (max-width:450px)
{
#main
{
margin:0;
}
}
img
{
max-width:85%;
display:block;
margin: 0 auto;
height: auto;
box-shadow: 5px 5px 3px 3px grey;
border-radius: 10%;
}
#img-div
{
padding:10px;
margin:0;
}
#img-caption
{
margin: 25px 0 20px 0 ;
font-size: 1.5em;
}
@media (max-width:450){
#img-caption
{
font-size: 1rem ;
}
}
ul
{
max-width: 990px;
margin:0 auto 50px auto;
text-align:left;
line-height:1.8;
}
li{
margin: 20px;
}
// !! 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