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.
<header>
jquery-data-api
<span>css örneği</span>
</header>
<div class="container">
<div class="flex-container">
<div class="flex-item">
<input type="number" data-state="left" step="20" placeholder="Soldan değeri">
</div>
<div class="flex-item">
<input type="number" data-state="top" step="20" placeholder="Yukarıdan değeri">
</div>
</div>
<div class="flex-container">
<div class="flex-item">
<input type="number" data-state="width" value="100" step="20" placeholder="Genişlik">
</div>
<div class="flex-item">
<input type="number" data-state="height" value="100" step="20" placeholder="Yükseklik">
</div>
</div>
<div class="flex-container">
<div class="flex-item">
<label>
<input type="checkbox" data-state="rounded" value="1">
Yuvarla
</label>
</div>
<div class="flex-item">
<input type="color" data-state="background" value="#afc6e4">
</div>
</div>
<div style="position: relative">
<div
data-css
data-css-background="$state.background"
data-css-width="$state.width + 'px'"
data-css-height="$state.height + 'px'"
data-css-left="($state.left || 0) + 'px'"
data-css-top="($state.top || 0) + 'px'"
data-css-border-radius="$state.rounded ? '50%' : ''"
style="transition: 300ms all; position: absolute; background: #274ae6"
></div>
</div>
</div>
<div class="container" data-state="font" data-value="16" style="margin-top: 150px">
<div class="text-action">
<button onclick="decreaseFont()">Metni Küçült</button>
<span data-block>{$state.font}px</span>
<button onclick="increaseFont()">Metni Büyüt</button>
</div>
<div class="error" data-block data-show="$state.error">
{$state.error}
</div>
<div class="text" data-css data-css-font-size="$state.font + 'px'" data-css-line-height="$state.font + ($state.font / 2) + 'px'">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc et risus eget elit pellentesque sagittis. Nunc sollicitudin convallis tempor. Vestibulum arcu enim, posuere a augue eu, interdum condimentum justo. Nam elementum est nibh, sit amet blandit felis semper id. Mauris lacinia blandit ultricies. Curabitur venenatis, purus suscipit aliquam aliquet, turpis felis bibendum nunc, finibus viverra lacus arcu id arcu. Proin dapibus, enim sed iaculis tincidunt, libero sem placerat urna, quis vestibulum arcu tortor vitae elit. Suspendisse at urna iaculis, efficitur risus id, dignissim erat. Nunc lacinia posuere turpis, sit amet venenatis turpis pretium vestibulum. Suspendisse sollicitudin eros viverra arcu condimentum, a varius diam aliquet. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi venenatis ligula ut neque tincidunt, ultricies ultricies nisl lacinia. Suspendisse tempor tempus neque, et venenatis tellus iaculis non. Sed et risus id libero dignissim mattis. Duis sed nunc sed libero semper elementum.
<br><br>
Praesent finibus tellus ut dui imperdiet volutpat. Morbi hendrerit maximus velit sed rutrum. Sed consequat placerat finibus. Nulla venenatis augue justo, nec commodo lacus faucibus ac. Etiam eget tellus at justo pellentesque interdum. Vestibulum ornare iaculis libero, eget lacinia nunc dictum eu. Nullam eu velit in felis eleifend porttitor sit amet sed ex. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Quisque laoreet semper nisi, quis gravida urna sollicitudin id. Cras a ex et massa fringilla pellentesque a aliquam ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
<br><br>
Vivamus tortor odio, feugiat sit amet pellentesque quis, lobortis sed augue. Curabitur consequat ante libero, sed ultrices ligula ullamcorper id. Duis nisi lorem, iaculis ut rhoncus vel, maximus sed metus. Ut lectus dui, pharetra nec imperdiet nec, pellentesque vel sem. Nulla et tincidunt ex. Morbi non metus ut mi tristique euismod nec sed odio. In sit amet libero tempus, dapibus lacus nec, posuere purus. Duis eget interdum diam. Praesent ullamcorper tortor pellentesque quam tincidunt, at rutrum enim aliquam. Donec posuere eget urna quis pharetra. Integer vel metus at lorem posuere ullamcorper in ut quam.
<br><br>
Ut id ligula ultricies metus porta malesuada. Mauris eu mi ex. Sed pretium magna sollicitudin, sollicitudin nulla non, mattis lorem. Fusce fermentum bibendum neque, id gravida est sagittis euismod. Nam ac nulla at ligula volutpat cursus in a tortor. Nullam commodo, lacus at blandit interdum, metus felis accumsan justo, in lobortis risus mauris eu tortor. Fusce odio velit, mattis sit amet consectetur sed, blandit sit amet leo. Praesent elementum elit ipsum, in pharetra ex rhoncus a. Nulla gravida vitae velit id ornare. Duis venenatis, justo ut bibendum lobortis, erat dui ultricies mauris, eu venenatis nulla ligula in turpis. Aenean vitae sodales odio, nec tempor eros.
<br><br>
Praesent viverra dapibus lacus, non scelerisque ligula pulvinar ac. Nunc posuere lorem vitae ipsum volutpat, eget aliquet metus porttitor. Curabitur eu tempus quam. Vestibulum sed sapien sit amet massa vestibulum mollis in id purus. Sed rutrum bibendum suscipit. Phasellus eget feugiat dolor. Sed ac quam eu metus viverra porttitor. Nullam varius dui vel quam dictum, ut aliquam mauris imperdiet. Sed ultrices faucibus orci in lacinia. Aenean id ornare nibh.
</div>
</div>
* {
padding: 0;
margin: 0;
list-style: none;
border: 0;
box-sizing: border-box;
text-decoration: none;
}
body {
background: #eee;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
}
header {
height: 60px;
background: #fff;
border-bottom: 1px solid #ddd;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-weight: 600;
margin-bottom: 20px;
}
header span {
margin-left: 15px;
padding-left: 15px;
border-left: 1px solid #ddd;
color: rgb(39, 74, 230);
}
.container {
width: 800px;
max-width: 100%;
margin: 0 auto;
background: #fff;
padding: 15px;
border-radius: 3px;
box-shadow: 3px 5px 10px 0 rgba(0,0,0,.1);
}
input[type="text"], input[type="number"], input[type="color"] {
width: 100%;
height: 50px;
border: 1px solid #ddd;
padding: 0 15px;
font-size: 16px;
border-radius: 3px;
}
select {
width: 100%;
height: 50px;
border: 1px solid #ddd;
padding: 0 15px;
font-size: 16px;
border-radius: 3px;
}
.flex-container {
display: flex;
gap: 10px;
align-items: center;
margin-bottom: 10px;
}
.flex-item {
flex: 1;
}
.flex-auto {
flex: auto;
}
.flex-button button {
width: 100%;
height: 50px;
background: rgb(39, 74, 230);
border-radius: 3px;
font-size: 16px;
color: #fff;
cursor: pointer;
}
.text-action {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
align-items: center;
}
.text-action button {
height: 40px;
display: inline-flex;
align-items: center;
padding: 0 20px;
border-radius: 4px;
background: #000;
color: #fff;
font-size: 16px;
cursor: pointer;
}
.error {
background: darkred;
color: #fff;
padding: 15px;
text-align: center;
margin-bottom: 15px;
}
const decreaseFont = () => {
if ($state.font - 2 >= $state.min){
updateState('font', $state.font - 2);
updateState('error', false);
} else {
updateState('error', 'Minimum font boyutuna ulaştınız!');
}
}
const increaseFont = () => {
if ($state.font + 2 <= $state.max){
updateState('font', $state.font + 2);
updateState('error', false);
} else {
updateState('error', 'Maksimum font boyutuna ulaştınız!');
}
}
setState('max', 24);
setState('min', 8);
setState('error', false);
Also see: Tab Triggers