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.
<main>
<h1><span>Braun HiFi</span> <span>studio Anlagen</span></h1>
<div>
<p>Als HiFi Spitzengeräte auf dem Weltmarkt erreichen Braun studio Anlagen das höchste Ziel: Musik so zu übertragen, wie sie wirklich ist.</p>
<p>Um diese so selbstverständlich scheinende Aufgabe in ihrer vollen Konsequenz zu lösen, bedurfte es jahrelanger Forschung, strengster Auswahl modernster elektronischer Bauelemente und Anwendung neuartiger Konstruktionen.</p>
<p>Braun studio Anlagen bestehen aus HiFi Komponenten, die man je nach Anspruch und Raumgröße individuell zusammenstellen kann. Jeder Bau­stein paßt zum anderen, technisch und formal.</p>
</div>
<img src="https://cdn.rawgit.com/huijing/filerepo/gh-pages/braun1.png">
<img src="https://cdn.rawgit.com/huijing/filerepo/gh-pages/braun2.png">
<img src="https://cdn.rawgit.com/huijing/filerepo/gh-pages/braun3.png">
<img src="https://cdn.rawgit.com/huijing/filerepo/gh-pages/braun4.png">
<svg viewBox="0 0 400 170" style="height:2em;"><path fill="#000" fill-rule="nonzero" d="M32.315 148.6H20.767v-35.564h11.548c7.914 0 11.58 5.9 11.58 16.46 0 14.5-4.398 19.103-11.58 19.103zM20.767 61.44h11.266c5.816 0 10.523 4.28 10.523 16.07 0 11.915-5.44 16.037-10.523 16.037H20.767V61.44zm30.82 40.508v-.098c4.578-3.213 11.897-8.74 11.897-26.505 0-22.952-11.976-33.348-28.153-33.348H0V168.03h35.146c19.92 0 29.62-14.765 29.62-36.765 0-20.525-8.053-26.193-13.18-29.317zm51.37-40.508h11.266c5.816 0 10.507 4.28 10.507 16.07 0 11.915-5.423 16.037-10.507 16.037h-11.266V61.44zm42.33 64.41c0-15.705-4.874-20.117-11.51-23.902v-.098c4.578-3.213 11.834-8.74 11.834-26.505 0-22.952-11.91-33.348-28.09-33.348H82.19V168.03h20.753l.014-54.994h11.262c5.902 0 10.124 4.908 10.124 16.047v38.948h20.928l.01-42.18h.005zm40.485-95.246c0-9.477 8.7-10.7 13.51-10.7 4.807 0 13.474 1.2 13.474 10.7l-.008 62.943h-26.99l.014-62.943zM199.282 0c-8.78 0-34.247 1.99-34.247 27.474v140.574h20.763v-55.002h26.96l-.007 54.98h20.78V27.473C233.537 1.943 208.03 0 199.28 0h.002zm96.442 41.97v99.216c0 5.05-4.175 8.422-10.377 8.422-6.23 0-10.328-3.38-10.328-8.422L275 41.97l-20.755.03-.005 102.5c0 19.518 20.065 24.72 31.13 24.72 10.963 0 31.114-5.23 31.114-24.742V41.97h-20.76zm82.978 126.045l-.008-99.172c0-5.05-4.172-8.422-10.37-8.422-6.232 0-10.336 3.387-10.336 8.427l-.006 99.172-20.764.015V65.53c0-19.516 20.068-24.72 31.132-24.72 10.964 0 31.108 5.23 31.108 24.743v102.464h-20.756v-.002z"/></svg>
</main>
// General styles
@import url('https://fonts.googleapis.com/css?family=Rubik:500');
html {
box-sizing: border-box;
height: 100%;
font-family: 'Rubik', sans-serif;
padding: 1em;
background-color: #f8f6f1;
}
*,
*::before,
*::after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
h1 {
font-size: 2em;
margin-bottom: 1em;
}
p {
margin-bottom: 1em;
}
img {
justify-self: center;
width: 100%;
}
svg {
margin-top: 1em;
}
// Layout styles
main {
display: grid;
grid-gap: 0.5em;
grid-template-columns: calc((100vw - 3em) / 3) calc((100vw - 3em) / 3) calc((100vw - 3em) / 3);
grid-template-areas: "title title title"
"text text text"
"key key key"
"detail1 detail2 detail3"
}
@media screen and (min-aspect-ratio: 1/1) and (min-height: 35em) {
main {
grid-template-columns: 18.75em 1fr 1fr 1fr;
grid-template-rows: calc((100vh - 3em) / 3) calc((100vh - 3em) / 3) calc((100vh - 3em) / 3);
height: calc(100vh - 2em);
grid-template-areas: "title key key key"
"text key key key"
"text detail1 detail2 detail3";
}
h1 span {
display: block;
}
img:first-of-type {
height: calc(((100vh - 2em) / 3) * 2);
object-fit: cover;
}
img:nth-of-type(2),
img:nth-of-type(3),
img:nth-of-type(4) {
height: calc((100vh - 3em) / 3);
object-fit: cover;
}
svg {
grid-area: text;
align-self: end;
}
}
@media screen and (min-aspect-ratio: 8/5) and (min-height: 35em) {
main {
grid-template-columns: 18.75em 4fr 1fr 1fr;
grid-template-rows: calc((100vh - 3em) / 3) calc((100vh - 3em) / 3) calc((100vh - 3em) / 3);
height: calc(100vh - 2em);
grid-template-areas: "title key . ."
"text key detail1 detail2"
"text . detail3 ."
}
div {
margin-top: -2em;
}
}
h1 {
grid-area: title;
}
div {
grid-area: text;
}
img:first-of-type {
grid-area: key;
}
img:nth-of-type(2) {
grid-area: detail1;
}
img:nth-of-type(3) {
grid-area: detail2;
}
img:nth-of-type(4) {
grid-area: detail3;
}
/* Fully responsive recreation of the Braun HiFi studio Anlagen regie 501 poster designed by Wolfgang Schmittel. An exercise in grid-template-areas, object-fit and aspect-ratio media queries. Fallback support to be added. */
Also see: Tab Triggers