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.
<body>
<h1 id="mainTitle">Passing the FCC projects: my way!</h1>
<nav id="navbar">
<header class="navBarTitle">Quick Navigation</header>
<ul>
<li><a href="#My_Structure" class="nav-link">My Structure</a></li>
<li><a href="#Resources" class="nav-link">Resources</a></li>
<li><a href="#Before_You_Start" class="nav-link">Before You Start</a></li>
<li><a href="#Gather_What_You_Need" class="nav-link">Gather What You Need</a></li>
<li><a href="#Start_Your_Build" class="nav-link">Start Your Build</a></li>
<li><a href="#Test_The_Build" class="nav-link">Test The Build</a></li>
</ul>
</nav>
<main id="main-doc">
<h2 id="description">Fighting my way through the projects, I have found a recipe that works for me.</h2><hr>
<section class="main-section" id="My_Structure">
<header><h3 class="sectionTitle">My Structure</h3></header>
<article><h3 class="articleHeading">This might seem an odd way to tackle the projects, but after fighting for days and days with my first project, going backwards and forwards, deleting huge chunks of code and starting again, over and over again, I have found this to be the way forward for me.</h3>
<ol>
<li>Set some time aside</li>
<li>Read through the instructions thoroughly</li>
<li>Draw my ideal layout</li>
<li>Hunt for images and links I will need</li>
<li>Set up a folder with all the files I need
<ol type="i">
<li>Images</li>
<li>Index</li>
<li>Style</li>
</ol>
<li>Build the page passing all of the tests</li>
<li>Style the page somewhere near where I want it to be</li>
<li>Add the content</li>
<li>Finalise the styling</li>
<li>Check in a responsive window</li>
<li>Submit</li>
</ol>
<hr>
</article>
</section>
<section class="main-section" id="Resources">
<header><h2 class="sectionTitle">Resources</h2></header>
<article>
<h3 class="articleHeading">The FCC curriculum is brilliant, but for me it was not enough to pass my first project</h3>
<p>What the curriculum gave me, was enough knowledge to find the questions I needed to ask, this led to many other places to find out information. Books, YouTube and Google searches. The ones I found most useful are listed below.</p>
<div class="videoLinks">
<p class="articleHeading">Follow these links for some great YouTube content.</p>
<a href="https://www.youtube.com/watch?v=pQN-pnXPaVg">This FCC video teaches the basics of HTML simply and brilliantly.</a><hr>
<a href="https://www.youtube.com/results?search_query=zero+to+hero+css">Another FCC video dives into CSS, this is a 6 hour video and it took me weeks to get through it but well worth it!</a><hr>
<a href="https://www.youtube.com/watch?v=56OJJTxCEN4">This video gives you the solution to the product landing page, I watch these before I start planning my projects.</a>
</div>
<p>I found <a href="https://www.w3schools.com/">W 3 Schools</a> to be invaluable when it comes to looking up code, it gives examples and I can try out the solution in their own CodePen<p>
<p>The book HTML by John Duckett is worth its weight in gold, I paid just under £5 second hand from<a href="https://www.amazon.co.uk/HTML-CSS-Design-Build-Websites/dp/1118008189/ref=sr_1_4?adgrpid=3818522352&hvadid=79852061861831&hvbmt=be&hvdev=c&hvlocphy=41353&hvnetw=o&hvqmt=e&hvtargid=kwd-79852071264734%3Aloc-188&keywords=jon+duckett+html&qid=1637871886&sr=8-4"> Amazon</a> it is missing CSS Grid and FlexBox but as a quick reference and a bit of bedtime reading, it taught me a great deal, especially after gaining a good understanding from the FCC curriculum.
</article>
</section>
<hr>
<section class="main-section" id="Before_You_Start">
<header><h2 class="sectionTitle">Before You Start</h2></header>
<article>
<h3 class="articleHeading">I was once taught <i>failing to plan is preparing to fail.</i></h3>
<p class="subHeading">Set some time aside.</p>
<p>This is vital, I've been driving my family mad with this, sneaking on the laptop to squeeze in 10 minutes here and there, it was, and still is frustrating for me and them. Its important to carve some quality time out to work on the projects, and let your family know what you are doing, don't say I'm going to finish this in 3 hours because you will just frustrate yourself, and those around you, just set some time aside to focus on the project and stick to it! <i>I'm still struggling with this.</i>
<p class="subHeading">Read through the instructions thoroughly.</p>
<p>I print off and read through several times, I make quick reference notes such as</p>
<p>My main element must contain <code>id="main-doc" .</code></p>
<p>There must be a minimum of 5 <code> section elements</code> within <code> the #main-doc</code> element.</p>
<p> The <code>.main-section</code> element must contain at least <code> 10 <p> elements.</code></p>
<p class="subHeading">Plan your build</p>
<p>I then watch the solution video, this gives me a greater understanding of what I need to do and how to approach the project. From this I draw up a quick wire frame to decide what I want to achieve in terms of layout, I try not to deviate too much from this, If I come across a problem I work to fix it rather than changing the layout.</p>
<hr>
</article>
</section>
<section class="main-section" id="Gather_What_You_Need">
<header><h2 class="sectionTitle">Gather What You Need</h2></header>
<article>
<h3 class="articleHeading">Go forth and hunt</h3>
<p>I found that when building my first page, I was going backwards and forwards from learning and building to looking for content. The distractions of hunting online for the correct image or the font I wanted was distracting during the build. So instead on my next project I found all this beforehand.</p>
<p>Doing this not only helped me to focus on the build, but when I found I had the wrong images too big, too small, wrong file path etc, it made me realise how important it is to get this right in the first instance.</p>
<p>Google fonts is a great place to find fonts to match the project, on this one I have chosen what I believe a techie font.</p>
<p>Font Awesome is perfect for icons, although it took me a while to learn how to use them.</p>
<p>Images are a nightmare.</p>
<p class="articleHeading">Prepare what you have gathered</p>
<p>When I watched the Zero to Hero video, I learned how to use a text editor,<a href="https://www.sublimetext.com/"> Sublime Text</a> I spent a lot of time working with it, so rather than using the CodePen for building the projects, I build them in the editor and then copy and paste them into CodePen.</p>
<p>Before I start I create a new folder on my PC this one is named <code>TechDocPage</code> then I create 3 new pages in sublime </p>
<ul>
<li class="subHeading">index.html</li>
<li class="indent">for my HTML</li>
<li class="subHeading">style.css</li>
<li class="indent">for my CSS</li>
<li class="subHeading">notes.txt</li>
<li class="indent">here I paste all of my links, and make notes for example, when I finish for the day I leave a note where I am up to, or subjects I am not sure on etc.</li>
</ul>
<p class="readyToBuild"> "Ready to build!"</p>
<hr>
</article>
</section>
<section class="main-section" id="Start_Your_Build">
<header><h2 class="sectionTitle">Start Your Build</h2></header>
<article><h3 class="articleHeading">Now you have everything, lay the first brick</h3>
<p>I always start by building the basic structure of the page, setting DOCTYPE, header, footer, body etc, then build within these tags.</p>
<p>Then I paste the below code, right at the end of my closing HTML tag, this allows me to run the FCC tests in my own browser.</p>
<p class="fccLink"> <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script></p>
<p>One by one I work through the User Stories, testing after each one and not moving onto the next until one has passed, sometimes if I'm feeling really smart I pass several tests at once.</p>
<p>Once I have all of my tests passing, using placeholder text, images etc I then go about styling the page.</p>
<p>Fonts go in first then focus on the layout, <i>the layout is the biggest headache for me.</i></p>
<p>Then I replace the dummy content with my content, this may seem a bit crazy but it allows me to focus on the build, rather than getting distracted with creating content. I'm sure as I get more practice I will just do it all in one go.</p>
<p>I then finalize the styling, formatting text size, decoration, colors etc. </p>
<p>Sometimes by changing elements it totally changes the layout, this has taught me to fix the problems, it may seem like a crazy way to approach a project but I have learned so much from this approach.</p>
<hr>
</article>
</section>
<section class="main-section" id="Test_The_Build">
<header><h2 class="sectionTitle">Test The Build</h2></header>
<article ><h3 class="articleHeading">Now that you have built, you need to test it against the elements</h3>
<p>I open up the project in Google Chrome right click and at the bottom of that menu click Inspect.</p>
<p>At the top right of the page you can select a responsive view.</p>
<p>Resize the window, making sure it is readable on different devices.</p>
<p>I have learnt to use relative units where possible such as <i>% em and rem.</i></p>
<p>On this particular project I have also used media queries to make sure it runs well on all viewports.</p>
<p>Once I'm relatively happy, I copy and paste both the HTML and CSS into CodePen and submit my project.</p>
</article>
</section>
<p class="articleHeading">Top tip, don't spend too much time on one problem, if you can't solve it in 15-20 minutes, walk away and do something else, then come back to it, if you can't fix it, use the forum, I cant believe how much help people are on there, and both times, the problem was simple and easily resolved with a bit of advice.</p>
</main>
</body>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
</html>
body{
background: #cccccc;
font-family: 'Orbitron', sans-serif;
font-size: 10px;
}
#mainTitle{
font-size: 2.5em;
text-align: center;
}
#navbar{
text-align: right;
max-width: 350px;
max-height: 600px;
position: fixed;
}
.navBarTitle{
font-size: 2.5em;
text-align: center;
}
.sectionTitle{
font-size: 1.56em;
text-align: center;
font-weight: 900;
border: 10px double #4d4d4d;
background: #e6e6e6;
margin-left: 20%;
margin-right: 20%;
font-family: 'Teko', sans-serif;
}
ul{
text-decoration: none;
list-style: none;
}
.titleDescription{
line-height: 20px;
margin-top: 0px;
border-bottom: 1px solid black;
}
#main-doc{
margin-left: 380px;
margin-right: 5%;
position: absolute;
}
a{
text-decoration: none;}
a:hover {color: black;}
code{
display: inline-block;
font-family: 'Share Tech Mono', monospace;}
.nav-link{
background: #8c8c8c;
text-decoration: none;
line-height: 2em;
font-size: 1.5em;
margin-left: 5px;
border-radius: .3em;
margin-right: 10px;
border: solid .2px black;
padding: 2px;
background: #e6e6e6;
font-family: 'M PLUS 1 Code', sans-serif;
}
.mainTitle{
text-align: center;
justify-content: center;
}
.articleHeading{
font-size: 1.2em;
font-weight: 600;
}
article{
font-size: 1.2em;
font-weight:400 ;
}
.videoArticleHeading{
line-height: 1px;
font-size: 1.2em;
font-weight: 600;
}
.videoLinks{
border: 1px double black;
background: white;
text-decoration: none;
text-align: center;
margin-left: 10%;
margin-right: 10%;
padding: 8px;
line-height: 1.2em;
}
.readyToBuild{
text-align: center;
font-weight: 600;
font-size: 1.2em;
font-style: italic;
}
.indent{
text-indent: 20pt;
}
.fccLink{
text-align: center;
font-weight: 600;}
#description{
font-size: 2em;
}
.subHeading{
font-size: 1.2em;
text-decoration: underline;
}
@media screen and (max-width: 780px) {
#navbar {
position: relative;
max-height: 10%;
width: 100%;
}
#main-doc{
position: relative;
margin-top:15%;
margin-left: 5%;
}}
Also see: Tab Triggers