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.
<ul class="scifiUI">
<li>
<input type="radio" name="tab" id="tab1" checked>
<label for="tab1">Tab1</label>
<div class="section">
The user interface, in the industrial design field of human–machine interaction, is the space where interactions between humans and machines occur. The goal of this interaction is effective operation and control of the machine on the user's end, and feedback from the machine, which aids the operator in making operational decisions. Examples of this broad concept of user interfaces include the interactive aspects of computer operating systems, hand tools, heavy machinery operator controls, and process controls. The design considerations applicable when creating user interfaces are related to or involve such disciplines as ergonomics and psychology.
</div>
</li>
<li>
<input type="radio" name="tab" id="tab2" />
<label for="tab2">Tab2</label>
<div class="section">
User Experience (UX) involves a person's behaviors, attitudes, and emotions about using a particular product, system or service. User Experience includes the practical, experiential, affective, meaningful and valuable aspects of human-computer interaction and product ownership. Additionally, it includes a person’s perceptions of system aspects such as utility, ease of use and efficiency. User Experience may be considered subjective in nature to the degree that it is about individual perception and thought with respect to the system. User Experience is dynamic as it is constantly modified over time due to changing usage circumstances and changes to individual systems as well as the wider usage context in which they can be found.
</div>
</li>
<li>
<input type="radio" name="tab" id="tab3" />
<label for="tab3">Tab3</label>
<div class="section">
Interactive Design is defined as a user-oriented field of study that focuses on meaningful communication of media through cyclical and collaborative processes between people and technology. Successful interactive designs have simple, clearly defined goals, a strong purpose and intuitive screen interface.
</div>
</li>
<li>
<input type="radio" name="tab" id="tab4" />
<label for="tab4">Tab4</label>
<div class="section">
In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids changing state and mutable data. It is a declarative programming paradigm, which means programming is done with expressions. In functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times. Eliminating side effects, i.e. changes in state that do not depend on the function inputs, can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming.
</div>
</li>
</ul>
@import url(https://fonts.googleapis.com/css?family=Rajdhani:300);
html, body {
background-color: #212121;
width: 100%;
height: 100%;
font-family: 'Rajdhani', sans-serif;
font-size: 18px;
}
.scifiUI {
list-style: none;
position: relative;
width: 600px;
margin: 50px auto;
padding: 0;
font-size: 1em;
color: #00bebe;
}
li {
display: inline-block;
}
li input[type="radio"] {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
position: absolute;
outline: none;
}
li input[type="radio"]:checked ~ label {
background: #00bebe;
color: #212121;
height: 50px;
font-size: 1.2em;
cursor: default;
box-shadow: 0 0 10px #00dcdc;
}
li input[type="radio"]:checked ~ .section {
filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false);
opacity: 1;
width: 500px;
padding: 50px;
border: 1px solid #00bebe;
color: #00dcdc;
letter-spacing: .1em;
text-indent: 1em;
z-index: 1;
}
li label {
display: block;
width: 120px;
height: 40px;
border: 1px solid rgba(0, 190, 190, 0.7);
border-bottom: 0;
border-radius: 5px 5px 0 0;
color: rgba(0, 190, 190, 0.7);
line-height: 50px;
text-align: center;
cursor: pointer;
transition: all 200ms ease-in-out;
}
li label:hover {
height: 50px;
border-color: #00bebe;
color: #00bebe;
}
li .section {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
position: absolute;
top: 51px;
left: 0;
width: 1000px;
padding: 50px;
border: 1px solid #00bebe;
background: rgba(0, 190, 190, 0.1);
color: white;
letter-spacing: -1em;
text-indent: 1em;
transition: all 200ms ease-in-out;
}
Also see: Tab Triggers