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.
.contenedor
form
- var pageTitle=['Home', 'Features', 'Adding pages to this template', '+More', 'About', 'Dummy page', 'Dummy page'] //Add pages by adding title here
- var content = [
- 'Pure CSS One page Vertical navigation',
- 'two',
- 'three',
- 'four',
- 'five'
- ]
- for( var n = 0; n < pageTitle.length; n++)
if n==0
input(type="radio" id="Slide1" name="slider" titulo=""+pageTitle[0] autofocus checked)
else
input(type="radio" id="Slide"+[n+1] name="slider" titulo=""+pageTitle[n])
.labels
- for( var n = 0; n < pageTitle.length; n++ )
if n==0
label(for="Slide"+[n+1] id="Slide"+[n+1] class="Slide")
.content: h1 <strong>Pure CSS</strong> one page vertical navigation
.icon
span: i.fa.fa-keyboard-o
span Use keyboard
else if n==1
label(for="Slide"+[n+1] id="Slide"+[n+1] class="Slide")
.content
h1 #{pageTitle[n]}
.block
span
i.fa.fa-hashtag
br
| <strong>No JS</strong>
br
| CSS Rules!
span
i.fa.fa-keyboard-o
br
| <strong>Pure CSS keyboard navigation</strong>
br
| Yep, no kidding
span
i.fa.fa-bars
br
| <strong>Lateral menu</strong>
span
i.fa.fa-codepen
br
| <strong>Autogenerate pages</strong>
br
| Using Jade & SASS
else if n==2
label(for="Slide"+[n+1] id="Slide"+[n+1] class="Slide")
.content
h1 #{pageTitle[n]}
.block: ol
li Add the pages title in the pageTitle array in the HTML editor to generate pages
li Add the number of pages in the $npages variable in the CSS editor
else if n==3
label(for="Slide"+[n+1] id="Slide"+[n+1] class="Slide")
.content
h1 #{pageTitle[n]}
.block
span: a(href="https://codepen.io/hrtzt/pen/NPZKRN" target="_blank") One Page Navigation CSS Menu
span: a(href="https://codepen.io/hrtzt/pen/YPoeWd" target="_blank") The simplest CSS switch
span: a(href="https://codepen.io/hrtzt/pen/JdYaEZ" target="_blank") Animated cube slider CSS only
span: a(href="https://codepen.io/hrtzt/pen/vGqEJO" target="_blank") Google photos album view with only CSS
else if n==4
label(for="Slide"+[n+1] id="Slide"+[n+1] class="Slide")
.content
h1 #{pageTitle[n]}
.block
span
a(href="https://dribbble.com/hrtzt" target="_blank")
i.fa.fa-dribbble
| Dribbble me
span
a(href="https://twitter.com/hrtzt" target="_blank")
i.fa.fa-twitter
| Tweet me
else
label(for="Slide"+[n+1] id="Slide"+[n+1])
.content
h1 #{pageTitle[n]}
.block Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto numquam, totam iusto officia earum perferendis
$npages: 7 /* This is the number of pages added in "pageTitle" in the HTML editor */
$bg: #2B2B38
$bg-odd: #F5004F
/* The basic stuff to make it work */
.contenedor
width: 100vw
height: 100vh
background: deeppink
position: relative
display: flex
align-items: center
form
box-sizing: border-box
text-align: center
padding: 22px
display: inline-flex
flex-direction: column
position: fixed
height: 100vh
justify-content: center
input
height: 0
margin: 12px 0
z-index: 1
&:checked
outline: 0
border: 0
&:before
content: ""
position: absolute
display: inline-block
width: 8px
height: 8px
border: 1px solid rgba(255, 255, 255, 0.81)
border-radius: 11px
cursor: pointer
transition: all .25s linear
&:checked:before
background-color: white
&:after
content: ""attr(titulo)""
position: relative
left: 30px
opacity: 0
color: white
font-size: 9px
display: block
min-width: 80px
transition: all .25s linear
&:checked:after
opacity: 1
left: 20px
&:hover:after:not(label)
opacity: 1
@for $i from 1 through $npages
&:nth-of-type(#{$i}):checked ~ .labels label
transform: translateY(-#{($i - 1) * 100%})
.labels
position: absolute
top: 0
left: 0
width: 100vw
height: 100vh
display: flex
flex-direction: column
label
min-width: 100vw
min-height: 100vh
display: flex
flex-direction: column
justify-content: center
align-items: center
background-color: $bg
z-index: 0
transition: all .75s cubic-bezier(0.75, 0.25, 0, 1.05)
&:nth-child(odd)
background-color: $bg-odd
color: white !important
/* Fancy style */
body
font:
family: 'Open sans', sans-serif
size: 16px
weight: 100
color: white
.content
width: 100%
box-sizing: border-box
padding: 0 110px
.block
width: inherit
font:
size: 11px
weight: 400
line-height: 1.5
margin: 42px 0
display: flex
justify-content: center
span
margin: 0 42px
i
margin-bottom: 22px
@extend span
&:before
font-size: 30px
.Slide:nth-child(even) .content .block
color: #717171
.icon
position: absolute
bottom: 30px
left: 0
right: 0
font-size: 11px
text-align: center
line-height: 1.5
display: flex
flex-direction: column
i
font-size: 22px
#Slide5 .content .block
flex-direction: column
i
margin: 0 12px
vertical-align: middle
strong
font-weight: 400
h1
text-transform: uppercase
ol
text-align: left
list-style-type: decimal
a
text-decoration: none
color: inherit
transition: all .25s linear
&:hover
color: rebeccapurple
/*
@author Alberto Hartzet
*
*I wouldn't mind if you use this piece of code in your project as long
as you give credit with a link to my site. www.albertohartzet.com
*
Licence (CC BY-NC-SA 4.0) http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
Also see: Tab Triggers