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">
<h1 class="section__headline">FAQs</h1>
<h2 class="c-faqs__headline">Initial Setup</h2>
<ul class="c-faqs">
<li class="c-faq c-faq--active">
<span class="c-faq__title">Do you want to build a snowman?</span>
<div class="c-faq__answer">Or ride our bikes around the halls I think some company is overdue I've started talking to the pictures on the walls (Hang in there, Joan!) It gets a little lonely All these empty rooms</div>
</li>
<li class="c-faq">
<span class="c-faq__title">Is Twilight autobiographical?</span>
<div class="c-faq__answer">No. Twilight is a work of fiction.</div>
</li>
<li class="c-faq">
<span class="c-faq__title">What do Vegetarians and Vegans do for Thanksgiving?</span>
<div class="c-faq__answer">Vegetarians and vegans enjoy all the same Thanksgiving pleasures as everyone else does, minus the turkey. There is an abundance of delicious vegetarian and vegan Thanksgiving food options available. Click here for compassionate Thanksgiving recipes.</div>
</li>
</ul> <!-- /end c-faqs -->
<h2 class="c-faqs__headline">Yolo swag</h2>
<ul class="c-faqs">
<li class="c-faq">
<span class="c-faq__title">What’s the largest turkey you ever raised?</span>
<div class="c-faq__answer">The largest turkey I have ever raised dressed out at 50.12 lbs.</div>
</li>
<li class="c-faq">
<span class="c-faq__title">What do I do when there is an alligator in my neighborhood?</span>
<div class="c-faq__answer">In many cases, if left unmolested, alligators eventually will retreat to more preferred habitats away from people. However, if you encounter an animal that poses a threat to human safety:
<br />
DON’T – swim outside of posted swimming areas or in waters that might contain large alligators.
<br />
DO – swim with a partner within all marked swimming areas. These areas are specifically situated and designed to reduce potential alligator/human conflicts.
<br/ >
DON’T – swim at night or dusk when alligators most actively feed.
</div>
</li>
<li class="c-faq">
<span class="c-faq__title">Who pays for Princes William and Harry?</span>
<div class="c-faq__answer">Both Prince William and Prince Harry receive a salary from the British Army. Any additional costs are met by The Prince of Wales or from their own private funds. If either Prince were to travel by air or train to an official engagement, these costs would be met from public funds.</div>
</li>
<li class="c-faq">
<span class="c-faq__title">Can I use someone else’s urine in my Whizzinator Kit?</span>
<div class="c-faq__answer">Yes, you can use someone else’s urine in our kit. We just ask that you be 110% sure the urine is clean before you use their urine. If you do use someone else’s urine simply collect the sample the day of your test and inject it into The Whizzinator with the refill syringe. Use the sample that day.</div>
</li>
<li class="c-faq c-faq">
<span class="c-faq__title">Do I have to be fat to do sumo?</span>
<div class="c-faq__answer">No, you do not have to be fat. In fact, most of the very successful sumo wrestlers, both professional and amateur, are not fat, by any standard. Generally, if you are athletic, you can do well in sumo. Of course, fat or skinny, big or small, you are welcome to participate in sumo.</div>
</li>
</ul> <!-- /end c-faqs -->
<h2 class="c-faqs__headline">Other questions</h2>
<ul class="c-faqs">
<li class="c-faq">
<span class="c-faq__title">Do you ever re-use chocolate?</span>
<div class="c-faq__answer">We never use chocolate left over from other rentals. We are more than happy to leave you with any chocolate left at the end of your rental if suitable bowls are provided.
</div>
</li>
<li class="c-faq">
<span class="c-faq__title">When I’m tested for a STD, will everyone in the waiting room hear my name be called?</span>
<div class="c-faq__answer">NO! The clinician will call you by your assigned number, not your name.</div>
</li>
<li class="c-faq">
<span class="c-faq__title">Can pregnant woman bellydance too?</span>
<div class="c-faq__answer">Of course, pregnant women find belly dancing excellent prenatal exercise because it strengthens the pelvic muscles and loosens up the abdominal area. It strengthens back and leg muscles, which are very critical for a woman to carry her pregnancy well.</div>
</li>
</ul> <!-- /end c-faqs -->
<span class="c-note">Source: <a href="http://www.usedfaqs.com/">usedfaqs.com</a></span>
</div>
$brand: #1e88e5
$black: #333
$lightblack: #505050
$lightwhite: #f1f2f3
%visually-hidden
position: absolute
opacity: 0
z-index: -1
body
box-sizing: border-box
font-family: 'ABeeZee', sans-serif
line-height: 1.48
font-size: 16px
color: $black
body *,
body *::after,
body *::before
box-sizing: inherit
.container
max-width: 1100px
margin-left: auto
margin-right: auto
.section__headline
font-family: 'Varela Round', sans-serif
font-size: 62px
font-weight: light
color: $brand
padding-left: 15px
padding-top: 30px
.c-faqs__headline
font-family: 'Varela Round', sans-serif
text-align: left
padding-left: 15px
font-size: 1.5em
margin-top: 1.5em
font-weight: bold
// has each one of the faqs
.c-faqs
margin: 15px 0
padding: 0 15px
border-top: 1px solid transparent // uncollapse margins
border-bottom: 1px solid transparent
// the divider between titles and questions
// .c-faqs::before
// width: 2px
// height: 100%
// left: 50%
// position: absolute
// background: $brand
// opacity: 0
// transform-origin: 0 50%
// content: ''
// a wrapper for each faq
.c-faq
font-family: 'Varela Round', sans-serif
list-style: none
margin: 10px 0 5px
.c-faq__title
cursor: pointer
font-weight: 500
background: white
z-index: 10
position: relative
font-size: 1.1em
&:hover
text-decoration: underline
&::after
white-space: nowrap
font-weight: 300
padding-left: 5px
opacity: 0
transform-origin: 11px
transform: rotateZ(90deg)
display: none
content: '>'
// active faqs should be a little different
.c-faq--active .c-faq__title
color: $brand
// the > icon
&::after
opacity: 1
transform: rotateZ(90deg)
display: inline-block
// the actual body of answer
.c-faq__answer
@extend %visually-hidden
font-weight: normal
margin-top: -10%
transition: all 0.1s
z-index: 1
font-size: 0.9em
color: $lightblack
.c-faq--active .c-faq__answer
opacity: 1
position: relative
top: 0
left: 0
font-weight: 300
margin-top: 5px
margin-bottom: 10px
transition: all 0.2s
border-radius: 3px
border: 1px solid $lightwhite
border-top: 1px solid $brand
padding: 20px
@media (min-width: 780px)
// use this as the 'wrapper' to position the answer
.c-faqs
position: relative
margin-left: auto
margin-right: auto
height: auto
// the bar betweeen question and answer
.c-faqs::before
opacity: 0.2
.c-faq
margin-top: 15px
margin-bottom: 15px
// title and answer shouldn't touch
.c-faq__title
width: 50%
padding-right: 40px
display: inline-block
// the > icon
&::after
display: none
// make this ver center, because questions will always will be higher :)
.c-faq__answer
position: absolute
top: 50%
transform: translateY(-50%)
left: 50%
width: 50%
border-left-color: $brand
border-top-color: $lightwhite
.c-note
font-size: 0.8em
padding-left: 15px
opacity: 0.5
transition: opacity 0.2s ease-in-out
&:hover
opacity: 1
transition: opacity 0.2s ease-in-out
a
color: $brand
$('body').delegate('.c-faq', 'click', function(){
$('.c-faq').removeClass('c-faq--active');
$(this).addClass('c-faq--active');
});
Also see: Tab Triggers