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>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600;700&family=Source+Sans+Pro:ital,wght@0,300;0,400;1,200;1,300;1,400&display=swap" rel="stylesheet">
</head>
<body>
<div id="body-img" class="bg1">
<div class="container">
<div class="words-container">
<h1 class="title">Write Like an Architect</h1>
<hr>
<p class="arch-text" id="arch-text-area">Maybe your ArchDaily submission is due in an hour but you've got nothing written yet. Maybe your firm's one overworked marketing assistant is on your ass to get the website copy updated so they can go home to their family. Or maybe you're just looking for "inspiration" for your next "amazing" project.<br><br> Use this tool to get yourself started.<br><br>(It's writing, how hard could it be?)</p>
<button type="button" class="generate-btn">Let's See Some Words</button>
</div>
</div>
</div>
</body>
body {
margin: 3vw 3vw;
text-align: left;
font-size: 16px;
}
#body-img {
width: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.bg1 {
background-image: url(https://images.unsplash.com/photo-1575152046278-adb86343e2a8?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80);
}
.bg2 {
background-image: url(https://images.unsplash.com/photo-1494216928456-ae75fd96603d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1500&q=80);
}
.bg3 {
background-image: url(https://images.unsplash.com/photo-1502394202744-021cfbb17454?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1178&q=80);
}
.bg4 {
background-image: url(https://images.unsplash.com/photo-1612875775405-a9eb2029a2e4?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=934&q=80)}
.bg5 {
background-image: url(https://images.unsplash.com/photo-1609519591065-996d4de118c1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80)}
.bg6 {
background-image: url(https://images.unsplash.com/photo-1613144123668-d9c705841eba?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1000&q=80)}
.bg7 {
background-image: url(https://images.unsplash.com/photo-1612703508477-00e02a9b170c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=962&q=80)}
.bg8 {
background-image: url(https://images.unsplash.com/photo-1611014667318-8fe8c9cb5829?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=976&q=80)}
.container {
display: flex;
flex-direction: row;
justify-content: center;
width: 80vw;
margin: 0 auto;
min-height: 90vh;
padding-bottom: 10vh;
}
.title {
color: #333;
font-size: 1.2rem;
font-weight: bold;
font-family: 'Shippori Mincho', serif;
text-align: center;
}
.words-container {
margin-top: 10vh;
padding: 2vh 4vh;
background: white;
width: 80%;
}
p {
min-height: 40vh;
color: #333;
font-family: 'Source Sans Pro', sans-serif;
font-weight: 400;
font-style: italic;
/* padding: 4vw; */
font-size: 1rem;
}
.generate-btn {
border: none;
padding: 1rem 1.5rem;
margin: 0;
width: 100%;
text-decoration: none;
background: #84ab85
;
color: #fff;
font-family: sans-serif;
font-size: .8rem;
cursor: pointer;
text-align: center;
-webkit-appearance: none;
-moz-appearance: none;
}
}
.generate-btn:hover {
background: #a9ccaa;
}
.generated-text {
padding-top: 2vh;
font-size: 1.3rem;
}
@media (min-width:48em){
body {font-size: 24px;}
.words-container {width:50%; padding:3vw;}
}
$(document).ready(function(){
textlistOne = ["Placed in", "Surrounded by", "Hovering above", "Placed within", "Inhabiting", "Standing near", "Realized in", "Inspired by", "Responding to", "Sited on", "Appearing in", "Constructed near", "Designed to echo", "Born from the conditions of", "Perched near", "Reimagined through"];
textlistTwo = ["a grove of tall junipers", "Japanese larch trees", "orchards and vineyards", "a garden of apple and cherry trees", "a steeply sloping site", "a wide expanse of prairie", "the wilderness outside a major city", "the rocks near the coast of a small island", "the woods at the bank of a river", "a quiet grassland", "a forested Arctic hillside", "the crumbling edges of a disused quarry", "the drab silence of a Phoenix suburb", "a wind-worn canyon wall", "a high desert plain", "endless backyards", "a quiet corner of greenery near downtown", "the bones of an old shipyard", "an unconvential waterfront context", "a steep cliff", "a small town", "a pine forest"];
textlistThree = ["the striking", "a cheerful", "this inconspicuous", "this elegant", "this alluring", "the one-of-a-kind", "this unique", "this surprising", "a lofty", "an alluring", "this lofty", "this cheerful", "this playful", "a playful", "this airy", "a simple", "this simple", "this formal", "this rustic", "a rustic", "this tiny", "this slender", "this inspiring", "a flexible", "this graceful", "this delicate", "this unassuming"];
textlistFour = ["wooden", "cedar-clad", "modern", "inconspicuous", "subtle", "striking", "monolithic", "contemporary", "charcoal-colored", "slate-clad", "wood-wrapped", "earth-toned", "low-slung", "elevated", "sunken", "half-hidden", "single-room", "sparsely furnished", "rammed-earth", "steel-clad", "space-efficient", "skewed", "semi-permanent", "weekend", "vacation"];
textlistFive = ["home", "treehouse", "project", "building", "house", "cabin", "retreat", "getaway", "aerie", "pavilion", "structure", "mass", "hideout", "observation platform", "vantage point", "series of spaces", "collection of rooms", "box"];
textlistSix = ["proves", "offers", "serves as", "provides", "creates", "acts as", "transforms into", "becomes"];
textlistSeven = ["a barely visible", "an ideal", "a remarkable", "a minimal and inspiring", "an evocative", "a memorable", "a playful", "a welcoming", "an ecologically aware", "a sensitive", "an independent", "a deceptively light", "a self-supporting", "a comfortable", "a snug", "a trendy", "a sustainable", "a resilient", "a glowing"];
textlistEight = ["mirror of its own surroundings", "retreat from city life", "gift from the owner to her children", "setting to partake in the ancient ritual of tea drinking", "link between outdoors and indoors", "expression of form and space", "space to reflect", "space to unwind", "space for contemplation", "space for celebration", "blurring of boundaries between architecture and nature", "retreat for creativity and reflection", "lookout for sleeping and dreaming", "venue for up and coming artists", "new way of vacationing responsibly", "beacon of a possible future for housing", "volume of light and warmth", "getaway from the hustle and bustle of everyday life", "place to have a beer or two", "base camp for your next adventure", "echo of a lost way of building", "live/work studio", "maker space", "collaboration hub", "writer's retreat", "artist's haven", "beacon in the dark", "potential example of housing typologies to come"];
classList = ['bg1','bg2','bg3','bg4','bg5','bg6','bg7','bg8'];
function generateName(){
var textOne = Math.floor(Math.random() * (textlistOne.length));
var textTwo = Math.floor(Math.random() * (textlistTwo.length));
var textThree = Math.floor(Math.random() * (textlistThree.length));
var textFour = Math.floor(Math.random() * (textlistFour.length));
var textFive = Math.floor(Math.random() * (textlistFive.length));
var textSix = Math.floor(Math.random() * (textlistSix.length));
var textSeven = Math.floor(Math.random() * (textlistSeven.length));
var textEight = Math.floor(Math.random() * (textlistEight.length));
$('.arch-text').text('"' + textlistOne[textOne] + " " + textlistTwo[textTwo] + ", " + textlistThree[textThree] + " " + textlistFour[textFour] + " " + textlistFive[textFive] + " " + textlistSix[textSix] + " " + textlistSeven[textSeven] + " " + textlistEight[textEight] + "...")
}
function swapClass(){
var randomClass = Math.floor(Math.random() * (classList.length));
var robotParagraph = document.getElementById("arch-text-area");
document.getElementById("body-img").className = classList[randomClass];
robotParagraph.classList.add("generated-text");
}
function doBoth(){
swapClass();
generateName();
}
$('.generate-btn').click(doBoth);
});
Also see: Tab Triggers