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.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/style_blog.css" type="text/css">
<title>Blog Mijn naam</title>
</head>
<body>
<div class="container_wrapper">
<header></header><!--hier komt de header -->
<nav><!--hier komt de navigatiebalk -->
<ul class="main_nav">
<li class="has-submenu">Home
<ul><li><a href="#">submenu</a></li>
<li><a href="#">submenu</a></li>
</ul></li>
<li><a href="#">About me</a></li>
</ul>
</nav>
<main><!-- Hier komt de inhoud van je blog/ -->
<section> <p class="datum">09 januari, 2024</p>
<h2>Bezoek aan de plantentuin in Gent</h2>
<p>Ons recente bezoek aan de <strong>Plantentuin in Gent</strong> was een onvergetelijke ervaring die ons project een vliegende start heeft gegeven. Omringd door een overvloed aan tropische planten, werden we overweldigd door de diversiteit en schoonheid van de natuur.</p>
<h3>Fotografie in de serres</h3>
<p>De serres waren een waar paradijs voor ons project. We hebben talloze foto's genomen van de meest fascinerende planten. De unieke vormen, levendige kleuren en intrigerende texturen van tropische flora hebben ons veel inspiratie gegeven. Hier zijn een paar van onze favoriete foto's:</p>
<div class="image_row"><div>
<img src="images/plantentuint.jpg" alt="Foto van Tropische Plant 1"></div>
<div><img src="images/plantentuint_2.jpg" alt="Foto van Tropische Plant 2"></div></div>
<p>Deze beelden zullen een belangrijke rol spelen in ons ontwerpproces, vooral bij het vormgeven van ons kartonnen doosje.</p>
<h3>Schetsen tussen het groen</h3>
<p>Naast fotografie hebben we ook de tijd genomen om ter plekke schetsen te maken. Het direct observeren van de planten hielp ons om de details nauwkeuriger vast te leggen en gaf ons een beter gevoel voor hun organische structuren. Hier zijn een paar schetsen die we hebben gemaakt:</p>
<div class="image_row"><div>
<img src="images/schets_2.jpg" alt="Foto van Tropische Plant 1"></div>
<div><img src="images/schets_1.jpg" alt="Foto van Tropische Plant 2"></div>
<div><img src="images/schets_1.jpg" alt="Foto van Tropische Plant 2"></div></div>
<p>Deze schetsen zullen de basis vormen voor het grafische ontwerp van onze verpakking.</p>
<h3>Reflectie en vooruitzichten</h3>
<p>Dit bezoek was meer dan alleen een foto- en schetssessie; het was een duik in de wereld van botanische wonderen. Het heeft ons geleerd om de subtiele schoonheid van de natuur te waarderen en hoe we deze kunnen vertalen in ons ontwerp. We kijken ernaar uit om deze elementen te integreren in ons kartonnen doosje project!</p>
</section>
<div class="separator"></div>
</main>
</div>
</body>
@charset "utf-8";
/* CSS Document */
@import url('https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Slab:wght@300&display=swap');
html{
font-family: 'Roboto', sans-serif;
font-size: 16px;
line-height: 1.5;
box-sizing: border-box;
}
h1, h2, h3, h4{
font-family: 'Roboto Slab', serif;
line-height: 1.2;
margin-bottom: 0;
padding-bottom: 0;
color :rgba(99,95,95,1.00);
font-weight: 300;
font-size: 2rem;
}
.datum{
color:rgba(157,156,156,1.00);
font-size:1rem;
font-variant: small-caps;
}
.datum + h1, .datum + h2, .datum + h3, .datum + h4 {
margin-top: 0.5rem; /* Aanpassen naar gewenste waarde */
}
.container_wrapper{
max-width: 1200px;
margin: 0 auto;
}
.main_nav{
display: flex;
justify-content: center;
align-items:center;
gap: 1rem;
list-style: none;
background-color:rgba(4,71,15,1.00);
color: rgba(255,255,255,1.00);
}
.main_nav > li.has-submenu::before {
content: "▼"; /* Voegt een pijltje naar beneden toe */
padding-right: 5px; /* Voegt wat ruimte toe tussen de tekst en het pijltje */
font-size:0.8rem;
}
.main_nav > li.has-submenu:hover::before {
color:red; /* Maakt het pijltje rood bij het hoveren */
}
.main_nav li a{
text-decoration: none;
color: white;
display: block;
padding:0.5rem;
}
.main_nav a:hover{
color:green;
}
.main_nav li {
position: relative;
}
.main_nav li ul {
position: absolute;
left: 0;
top: 100%;
background-color: rgba(4,71,15,1.00);
min-width: 100%;
display: none;
list-style: none;
margin: 0;
padding: 0;
}
.main_nav li:hover > ul {
display: block;
}
main_nav ul li {
display: block; /* Zorgt ervoor dat submenu items verticaal gestapeld zijn */
text-align: left;
}
.image_row{
display: flex;
justify-content: center;
gap:1rem;
}
.separator{
content: "";
margin-left: -1rem;
width: 50px;
height: 5px;
background-color: rgba(131,127,127,1.00);
}
section{
max-width: 800px;
}
img{
max-width: 100%;
height: auto;
}
.main_nav li ul {
display: none;
}
.main_nav li ul.is-visible {
display: block; /* Of een andere display modus afhankelijk van je layout */
}
@media only screen and (max-width: 600px) {
.main_nav li ul {
position: static; /* Dit zorgt ervoor dat submenu's in de normale documentstroom staan */
display: none; /* Houd submenu's verborgen totdat ze worden getoogled */
width: 100%; /* Laat submenu's de volledige breedte van hun ouder innemen */
min-width: 100%; /* Verzekert dat submenu's niet proberen breder te zijn dan hun ouder */
}
.main_nav > li {
display: block; /* Zorgt ervoor dat elk menu-item de volledige breedte van de container inneemt */
}
.main_nav {
flex-direction: column; /* Stapelt menu-items verticaal */
align-items: flex-start; /* Lijnt items uit aan de linkerkant */
}
}
document.addEventListener('DOMContentLoaded', function() {
var menuItems = document.querySelectorAll('.main_nav li');
function isTouchDevice() {
return (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
}
function toggleSubmenu(submenu) {
// Check of het submenu al zichtbaar is
if (submenu.classList.contains('is-visible')) {
submenu.classList.remove('is-visible');
} else {
// Sluit alle andere submenu's voordat het huidige wordt geopend
document.querySelectorAll('.main_nav li ul').forEach(function(el) {
el.classList.remove('is-visible');
});
submenu.classList.add('is-visible');
}
}
if (isTouchDevice()) {
menuItems.forEach(function(item) {
item.addEventListener('click', function(event) {
var submenu = this.querySelector('ul');
if (submenu) {
toggleSubmenu(submenu);
event.stopPropagation();
}
});
});
} else {
// Niet-touch apparaten: hover functionaliteit
menuItems.forEach(function(item) {
var submenu = item.querySelector('ul');
if (submenu) {
item.addEventListener('mouseenter', function() {
submenu.classList.add('is-visible');
});
item.addEventListener('mouseleave', function() {
submenu.classList.remove('is-visible');
});
}
});
}
// Globale klik event om submenu's te sluiten wanneer er buiten wordt geklikt
document.addEventListener('click', function(e) {
if (!e.target.closest('.main_nav')) {
document.querySelectorAll('.main_nav li ul').forEach(function(el) {
el.classList.remove('is-visible');
});
}
});
});
Also see: Tab Triggers