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>
<head>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<title>Technical Documentation Page</title>
<main id="main-doc">
<section id="css_introduction" class="main-section">
<header>
<h2>CSS Introduction</h2>
</header>
<p>CSS is a style sheet language. The language is used for describing the presentation of a document written in HTML, or other such markup languages such as XHTML, plain XML, SVG, and XUL. Together with HTML and JavaScript, CSS is an important part of the World Wide Web. One of the main features of CSS is that it allows the user to separate the presentation and content of a page, such as fonts, colors, layout. Thanks to the separation, the user's accesability, control, and flexibility are increased.</p>
<p>Another benefit of using CSS is the fact that a single page can be presented in various styles for different methods: on Braille-based tactile devices, by voice, in print, or on-screen. CSS can also be used to easily format the page in a style suitable for mobile devices.</p>
<ul>
<h3>CSS Trivia</h3>
<li class="lineclass">CSS stands for <strong>Cascading Style Sheets</strong>.</li>
<li class="lineclass">CSS's filename extension is <code>.css</code>.</li>
<li class="lineclass">CSS's internet media type is <code>text/css</code>.</li>
<li class="lineclass">Since CSS can control the layout of multiple web pages at once, it saves a lot of work.</li>
</ul>
</section>
<section id="css_syntax" class="main-section">
<header>
<h2>CSS Syntax</h2>
</header>
<p>A CSS style rules are interpreted by the browser and then applied to the corresponding elements in your document. A rule-set is made out of a selector and a declaration block. The declaration can be further broken-down into a property and a value, so the three elements are: selector, property, and value.</p>
<img src="https://www.tutorialspoint.com/css/images/syntax.png"</img>
<p>The selector refers to the HTML element you want to style. Any HTML tag such as head, paragraph, etc. The property is a type of attribute of the HTML tag. It can represent the color, the border, the font-family, etc. Finally, the value is assigned to the property. Color can have a value of red, blue, and so on; the font-family can be arial, times new roman, and so on. The CSS style rule syntax can be written as <code style="background-color:#DCDCDC">selector { property: value }</code>.</p>
</section>
<section id="css_selectors" class="main-section">
<header>
<h2>CSS Selectors</h2>
</header>
<!-- Trebuie sa ma gandesc daca sa las asa, sau sa mentionez astea din lista si apoi sa fac o lista pt astea simple: Element, id, class -->
<p>Perhaps the biggest key to understanding CSS is understanding selectors. As previously mentioned, CSS selectors are used to select or find the HTML element you want to style. There are 5 types of CSS selectors: Simple, Combinator, Pseudo-class, Pseudo-elements, and Attribute. We will focus on the simple selectors, which can be further divided into:
<ul>
<li class="lineclass">CSS Element selector</li>
<li class="lineclass">CSS ID selector</li>
<li class="lineclass">CSS Class selector</li>
<li class="lineclass">CSS Universal selector</li>
</ul></p>
<p id="simple_selectors"><strong>The element selector</strong> allows you to select HTML elements based on their element name. For example: <code style="background-color:#DCDCDC">p {text-align: center;}</code>. In this case, all paragraph elements will be center-aligned.<br>
<strong>The id selector</strong> used the id attribute of an HTML element. The id of an element is unique, so thanks to it we can select one unique element. We set the id to an element, and then we choose that id by adding (#) before the given name. For example if a h1 was set with the id of "first_header", then the code will look like: <code style="background-color:#DCDCDC">#first_header {color: red;}</code>. In this case, the header with the id first_header will change its color to red. ID selectors are the most powerful type of selector in terms of CSS specificity.<br>
<strong>The class selector</strong> is similar to the id one, but the maine difference is that we can add the same class to numberous elements, whereas we can add an id to a single element. In case we want to make the same change to various elements, it is more practical to assign the same class, than to assign numerous ids. We set the class to an element, and then we choose that id by adding (.) before the given name. They are possibly the most useful and versatile selectors out there, as they are supported in all browsers, and they can easily be manipulated through JavaScript.<br>
<strong>The universal selector</strong> (*) selects all HTML elements on the page. An asterisk can also be followed by a selector. This is useful when you want to set a style for of all the elements of an HTML page or for all of the elements within an element of an HTML page.
</p>
</section>
<section id="how_to_add_css" class="main-section">
<header>
<h2>How to add CSS</h2>
</header>
<p>The CSS can be added in three different manners:
<ul>
<li class="lineclass">Inline CSS - You add the style attribute to the relevant element</li>
<li class="lineclass">Internal CSS - The internal style is defined inside the <em>style</em> element, inside the head section.</li>
<li class="lineclass">External CSS - An external style sheet can be written in any text editor, and must be saved with a .css extension. The HTML page must refer to it in the <em>link</em> element.</li>
</ul>
</p>
</section>
<section id="css_flexbox" class="main-section">
<!-- Not sure about the last one. Will need to do more research-->
<header>
<h2>CSS Flexbox</h2>
</header>
<p>The Flexible Box Module, usually referred to as flexbox, was designed as a one-dimensional layout model, and as a method that could offer space distribution between items in an interface and powerful alignment capabilities</p>
<p>When we describe flexbox as being one dimensional we are describing the fact that flexbox deals with layout in one dimension at a time — either as a row or as a column. This can be contrasted with the two-dimensional model of CSS Grid Layout, which controls columns and rows together. The main idea behind the flex layout is to give the container the ability to alter its items' width/height (and order) to best fill the available space (mostly to accommodate to all kind of display devices and screen sizes). A flex container expands items to fill available free space or shrinks them to prevent overflow.</p>
</section>
</main>
</head>
<!-- Sa vad cum sa fac cu borders, sa incerc sa imi dau seama de cum ar arata mai ok. Sa modific in navli, si sa incerc sa scot bullet points. Also, sa vad cu impartirea in pagina, culoarea, etc-->
<nav id="navbar">
<header id="navinfo">CSS Information</header>
<ul id="navul">
<li class="navli"><a class="nav-link" href="#css_introduction">CSS Introduction</a></li>
<li class="navli"><a class="nav-link" href="#css_syntax">CSS Syntax</a></li>
<li class="navli"><a class="nav-link" href="#css_selectors">CSS Selectors</a></li>
<li><a class="nav-link" href="#how_to_add_css">How to add CSS</a></li>
<li><a class="nav-link" href="#css_flexbox">CSS Flexbox</a></li>
</ul>
</nav>
</html>
#main-doc {
position: absolute;
right: 0;
bottom: 20;
padding-left: 270px;
margin-left: 300px;
padding:20px;
}
#simple_selectors {
line-height: 25px;
}
#navbar {
position: fixed;
top: 0;
left: 0;
width: 300px;
min-width: 290px;
height: 38%;
background-color: #F5F5F5;
border: solid;
border-style: hidden;
}
#navul {
list-style: none;
line-height: 50px;
font-size: 20px;
text-align: left;
margin: 0 auto;
}
#navinfo {
margin-top: 20px;
font-weight: bold;
text-align: center;
font-size: 28px;
padding-bottom: 15px;
margin-left: -13px;
}
a {
text-decoration: none;
font-size: 20px;
font-family: times new roman, arial;
text-align: center;
}
/* unvisited link */
a:link {
color: black;
}
/* visited link */
a:visited {
color: black;
}
p {
font-family: times new roman;
line-height: 25px;
}
.lineclass {
line-height: 25px;
}
@media screen and (max-width: 600px) {
#main-doc {
width: 80%;
padding-top: 380px;
}
img {
width: 100%;
}
#navbar {
position: absolute;
top: 0;
padding-bottom: 200px;
margin-bottom: 200px;
width: 70%;
max-height: 200px;
margin-left: 50px;
}
#navul {
width: 100%;
font-size: 5px;
}
#navli {
font-size: 3px;
}
}
Also see: Tab Triggers