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.
<head>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<title>CSS Text</title>
<link href="https://fonts.googleapis.com/css?family=Cabin|Roboto:400,700|Roboto+Condensed:400,700" rel="stylesheet">
</head>
<main id="main-doc">
<nav id="navbar">
<header>
<h1>
CSS Text
</h1>
</header>
<ul>
<li><a class="nav-link" href="#CSS_Text_Color">CSS Text Color</a></li>
<li><a class="nav-link" href="#CSS_Text_Alignment">CSS Text Alignment</a></li>
<li><a class="nav-link" href="#CSS_Text_Decoration">CSS Text Decoration</a></li>
<li><a class="nav-link" href="#CSS_Text_Transformation">CSS Text Transformation</a></li>
<li><a class="nav-link" href="#CSS_Text_Spacing">CSS Text Spacing</a></li>
<li><a class="nav-link" href="#CSS_Text_Shadow">CSS Text Shadow</a></li>
<li><a class="nav-link" href="#Reference">Reference</a></li>
</ul>
</nav>
<div class="sections">
<section class="main-section" id="CSS_Text_Color">
<header>
CSS Text Color
</header>
<p>The color property is used to set the color of the text. The color is specified by:</p>
<ul>
<li>a color name - like "red"</li>
<li>a HEX value - like "#ff0000"</li>
<li>an RGB value - like "rgb(255,0,0)"</li>
</ul>
<code>body { color: blue; } h1 { color: green; }</code>
<p>The default text color for a page is defined in the body selector.</p>
</section>
<section class="main-section" id="CSS_Text_Alignment">
<header>
CSS Text Alignment
</header>
<p>The text-align property is used to set the horizontal alignment of a text.</p>
<p>A text can be left or right aligned, centered, or justified.</p>
<p>The following example shows center aligned, and left and right aligned text (left alignment is default if text direction is left-to-right, and right alignment is default if text direction is right-to-left):</p>
<code>h1 { text-align: center; } h2 { text-align: left; } h3 { text-align: right; }</code>
</section>
<section class="main-section" id="CSS_Text_Decoration">
<header>
CSS Text Decoration
</header>
<p>The text-decoration property is used to set or remove decorations from text.</p>
<p>The value text-decoration: none; is often used to remove underlines from links:</p>
<code>a { text-decoration: none; }</code>
</section>
<section class="main-section" id="CSS_Text_Transformation">
<header>
CSS Text Transformation
</header>
<p>The text-transform property is used to specify uppercase and lowercase letters in a text.</p>
<p>It can be used to turn everything into uppercase or lowercase letters, or capitalize the first letter of each word:</p>
<code>p.uppercase {
text-transform: uppercase;
}
p.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}</code>
</section>
<section class="main-section" id="CSS_Text_Spacing">
<header>
CSS Text Spacing
</header>
<p>Here are five different properties used in text spacing</p>
<ul>
<li>Letter Spacing</li>
<li>Line Height</li>
<li>Word Spacing</li>
<li>White Space</li>
<li>Text Indentation</li>
</ul>
<p>The text-indent property is used to specify the indentation of the first line of a text:</p>
<code>p {
text-indent: 50px;
}</code>
</section>
<section class="main-section" id="CSS_Text_Shadow">
<header>
CSS Text Shadow
</header>
<p>The text-shadow property adds shadow to text.</p>
<p>In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow (2px):</p>
<code>h1 {
text-shadow: 2px 2px;
}</code>
</section>
<section class="main-section" id="Reference">
<header>
Reference
</header>
<ul>
<li>All the documentation in this page is taken from <a class="schools" href="https://www.w3schools.com/css/css_text.asp">W3Schools</a>.</li>
</ul>
</section>
</div>
</main>
html,
body {
min-width: 290px;
color: #4d4e53;
background-color: #ffffff;
font-family: "Open Sans", Arial, sans-serif;
line-height: 1.5;
}
#navbar {
position: fixed;
min-width: 290px;
top: 0px;
left: 0px;
width: 300px;
height: 100%;
border-right: solid;
border-color: rgba(0, 22, 22, 0.4);
}
header {
color: black;
margin: 10px;
text-align: center;
font-size: 1.8em;
font-weight: thin;
Font-Family: 'Roboto Condensed', Sans-Serif;
color: #5B949A;
}
h1 {
padding-left: 2vw;
font-size: 1.2em;
color: #5B949A;
}
p {
Font-Family: 'Cabin', Sans-Serif;
}
#main-doc header {
text-align: left;
margin: 0px;
}
#navbar ul {
height: 88%;
padding: 0;
overflow-y: auto;
overflow-x: hidden;
}
#navbar li {
color: #4d4e53;
border-top: 1px solid;
list-style: none;
position: relative;
width: 100%;
Font-Family: 'Cabin', Sans-Serif;
}
#navbar a {
display: block;
padding: 10px 30px;
color: #4d4e53;
text-decoration: none;
cursor: pointer;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
}
#navbar a:hover { background-color: #B5CCCE; }
a {
color: #568287;
text-decoration: none;
cursor: pointer;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
}
a:hover {color: #84B3B8 ; }
#main-doc {
position: absolute;
margin-left: 310px;
padding: 20px;
margin-bottom: 110px;
}
section article {
color: #4d4e53;
margin: 15px;
font-size: 0.96em;
}
section li {
margin: 15px 0px 0px 20px;
Font-Family: 'Cabin', Sans-Serif;
}
code {
display: block;
text-align: left;
white-space: pre;
position: relative;
word-break: normal;
word-wrap: normal;
line-height: 2;
background-color: #f7f7f7;
padding: 15px;
margin: 10px;
border-radius: 5px;
}
@media only screen and (max-width: 815px) {
/* For mobile phones: */
#navbar ul {
border: 1px solid;
height: 165px;
}
#navbar {
background-color: white;
position: absolute;
top: 0;
padding: 0;
margin: 0;
width: 100%;
max-height: 275px;
border: none;
z-index: 1;
border-bottom: 2px solid;
}
#main-doc {
position: relative;
margin-left: 0px;
}
.sections {
margin-top: 55vw;
}
h1 {
text-align: center;
}
}
@media only screen and (max-width: 400px) {
#main-doc {
margin-left: -10px;
}
code {
margin-left: -20px;
width: 100%;
padding: 15px;
padding-left: 10px;
padding-right: 45px;
min-width: 233px;
}
}
Also see: Tab Triggers