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.
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-12 col-sm-8 col-md-6">
<div class="card text-center">
<div class="card-header">
<h6 id="card-title">Big question generator</h6>
</div>
<div class="card-body">
<p class="card-text align-self-center question" id="q">Can you cook?</p>
<button type="button" class="btn btn-primary" onclick="randomize()">Random Question!</button>
<button type="button" class="btn btn-info" id="info-btn" data-toggle="modal" data-target="#infoModal">Info</button>
</div>
</div>
</div>
</div>
</div>
.card {
margin: 40px auto 25px auto;
}
.question {
font-size: 20px;
font-color: grey;
min-height: 4rem;
margin: 10px auto;
}
.col-sm-8 > .card > .card-body > .question{
min-height: 5rem;
}
.col-12 > .card > .card-body > .question{
min-height: 7rem;
}
#card-title {
text-transform: uppercase;
margin: auto;
}
questions = ['Do you believe in Karma?',
'What makes you feel alive?',
'Do you think children should be taught how to cook?',
'Can you cook?',
'What should be taught in schools?',
'Which piece of music moves you the most?',
'Do you believe in God?',
'What is the closest to your heart?',
'Do you have any ideas on gender equality?',
'Where would you have liked to spend your childhood?',
'Do you think equality and justice are one and the same?',
'What do you think about religious reforms?',
'In your opinion which book should everybody in the universe read?',
'If you could change one thing about yourself overnight, what would it be?',
'What kind of life is a life worth living?',
'What\'s on your bucket list?',
'If given all the resources, where would you like to go in the entire world and why?',
'Should cat videos be banned from YouTube?',
'What is your biggest fear? Do you plan to confront it?',
'Invisibility or the ability to fly?',
'What do you think is the right age to get married?',
'What do you think about LGBTQ?',
'Marijuana(weed) is slowly being legalised in the USA, the world might soon follow. What do you think about it?',
'What is your idea of a perfect holiday?',
'Lot of artists take drugs before their performance, do you think it has become a neccessity to get their real potential out?',
'What do you enjoy doing the most?',
'When was the last time you cried?',
'Gandhiji said be the change you want to see. What is the change you want to be?',
'If you could be God for a day what would you do?',
'What is one thing about you that you wouldn\'t want to change?',
'If you find out that you have 1 month to live, what would you do?',
'Do you believe in meditation?',
'What do you think about death?',
'What is something that you wouldn\'t even wish upon your enemies?',
'What makes you a badass?',
'Do you believe in planning your future or do you prefer going with the flow?',
'If given a chance to change a decision that you\'ve taken in the past, what would you change?',
'Should humans colonize other planets?',
'Is there anything about your life that you want to change?',
'How should a child be taught discipline?',
'What is the one thing that you want to change about yourself?',
'If you could pick a way to die, what would you choose?',
'A house next to a library or one next to a pub?',
'Where would you go for your honeymoon?',
'What has been your biggest failure?',
'What is a happy moment that you will always remember?',
'What is something that you didn\'t learn from Google?',
'What are some things that offend you?',
'Are you a cat person or a dog person?',
'What is the strangest thing you have ever eaten?',
'Trip to outer space or bottom of the ocean?',
'How do you define luck? And how do you think it defines your life?',
'Do you think money can buy happiness?',
'What is the craziest thing you\'ve ever done?',
'What are the 3 things that can always be found in your bag?',
'What do you think is the ulitmate waste of money?',
'What is the best feeling in the world?',
'Do you believe in reincarnation, rebirth etc? Why?',
'Would you call yourself an introvert or an extrovert?',
'Name two things you want to change in yourself.',
'What is the right age to have kids?',
'Do you remember any dream in particular?',
'What are some life experiences that you think everyone should have?',
'What do you think are some unfair advantages people are born with?',
'If you could live a TV show, a book, or a movie, which one will it be?',
'What is one book that every child should read?',
'What is the most difficult thing that you\'ve done for someone you love?',
'What is love?',
'Can love and lust be seperated?',
'For what do you feel the most grateful for in your life?',
'If you could get away with a crime, what will it be?',
'How will you spend a billion dollars?',
'If you were to get a tattoo, what would it be?',
'How do you want to be remembered?',
'When was the happiest moment in your life?',
'What was your dream job while growing up? How has it changed now?',
'Who has been the most influential person in your life?',
'Do you believe in soul mates?',
'If you could master one skill you don\'t have right now, what will be it be?',
'How will you define a "perfect" day?',
'If you could speak another language, what will it be and why?',
'What is the best thing someone has ever done for you?',
'If you could time travel, will you go to your past or your future?',
'What is the best meal you\'ve had recently?',
'Would you rather be a jack of all trades or master of one?',
'How would your best friends describe you?',
'Would you rather live in the city or the woods?',
'Are you a night person or a day person? Why?',
'Any interesting story behind your name? Did you ever think of changing it?',
'If you could invite any one person to dinner, who will it be?',
'Airplanes, ships, trains or cars? Why?',
'If asked to completely give up social media (including Whatsapp) would you be able to? Why or why not?',
'Do you have a secret hunch about how you\'ll die?',
'What has been the hardest phase of your life?',
'If you could travel anywhere even through time, where would you go? Why?',
'A luxury holiday or camping?',
'If you had a door that could take you to any room, where will you go?',
'Do you think there is a difference between a traveller and a tourist?',
'What do you think is the purpose of life?',
'Which sport do you follow or play? What you like about it?',
'Do you ever feel lost?',
'Do you think people were happier in the olden days?',
'What is your earliest childhood memory?',
'Have you thought of picking a resting place for your body after your death?'];
document.onload = randomize();
document.onload = openModal();
function randomize(){
document.getElementById('q').innerHTML = questions[Math.floor(Math.random()*questions.length)]
}
function openModal(){
document.getElementById('info-btn').click();
}
Also see: Tab Triggers