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.
<script type="text/javascript" src="https://snxd.akamaized.net/js/stamp-1.0.14.js"></script>
<div ng-app="multi-download-app" ng-controller="multi-download-cart" id="multi-download-app">
<table>
<tr>
<th><h4>Industry</h4></th>
<th><h4>Sample</h4></th>
<th><h4>Description</h4></th>
<th><h4>Size</h4></th>
<th><h4>Download</h4></th>
</tr>
<tr ng-repeat="item in items">
<td>
<b>{{ item.name }}</b>
</td>
<td>
<div ng-repeat="image in item.images">
<img ng-src="{{image}}" width="150" align="left" />
</div>
</td>
<td ng-bind-html="item.description"></td>
<td>{{ item.size }}</td>
<td>
<center>
<div class="item-in-cart">
<input class="download-item" id="checkbox-{{$index}}" type="checkbox" ng-model="item.checked" ng-change="checkItem()" value="None">
<label for="checkbox-{{$index}}"></label>
</div>
</center>
</td>
</tr>
</table>
<button class="alignright" disabled="disabled" ng-click="downloadItems()">
<i class="fa fa-download"></i> Download Selected Items</button>
</div>
#multi-download-app .download-popup {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
#multi-download-app table {
border-collapse: collapse;
background-color: white;
}
#multi-download-app td,
#multi-download-app th {
font-family: Open Sans;
font-size: 15px;
color: #535353;
vertical-align: top;
line-height: 1.6;
border: 0px solid lightgray;
}
#multi-download-app td {
padding: 10px;
}
#multi-download-app td:nth-child(1) {
width: 100px;
text-align: center;
}
#multi-download-app td:nth-child(2) {
width: 170px;
text-align: center;
}
#multi-download-app td:nth-child(5) {
width: 170px;
text-align: center;
}
#multi-download-app td img {
padding-right: 6px;
padding-bottom: 6px;
}
#multi-download-app th {
background-color: #e7e2e2;
}
#multi-download-app th h4 {
font-weight: 700;
text-align: center;
text-transform: uppercase;
margin: 6px;
}
#multi-download-app button {
font-family: Raleway, Open Sans;
font-weight: 600;
text-transform: uppercase;
border-width: 0px;
border-bottom: 3px;
border-color: #73353f;
border-style: solid;
border-radius: 4px;
padding: 8px;
padding-left: 16px;
padding-right: 16px;
background-color: #a24d4f;
color: white;
}
#multi-download-app button:hover {
color: #f8f1d1;
cursor: pointer;
}
#multi-download-app button:disabled {
background-color: #e0e0e0 !important;
border-color: lightgray !important;
color: #909090 !important;
}
#multi-download-app button.alignright {
float: right;
}
#multi-download-app .item-in-cart {
width: 20px;
position: relative;
}
#multi-download-app .item-in-cart label {
width: 20px;
height: 20px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
background: #ffffff;
background: linear-gradient(to bottom, #ffffff 0%, #f1f1f1 40%, #cecece 100%);
border-radius: 4px;
border: 1px solid #c0c0c0;
}
#multi-download-app .item-in-cart label:after {
content: '';
width: 9px;
height: 5px;
position: absolute;
top: 5px;
left: 4px;
border: 3px solid #333;
border-top: none;
border-right: none;
background: transparent;
opacity: 0;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
#multi-download-app .item-in-cart label:hover::after {
opacity: 0.5;
}
#multi-download-app .item-in-cart input[type=checkbox] {
visibility: hidden;
}
#multi-download-app .item-in-cart input[type=checkbox]:checked + label:after {
opacity: 1;
}
angular.module('multi-download-app', ['ngSanitize'])
.controller('multi-download-cart', function ($scope) {
// List of all items available for download
$scope.items = [
{
"name": "Oil",
"images": ["https://snxd.akamaized.net/demoassets/earth/GeoEye_Ikonos_Oil_2005NOV25.png"],
"description": "High resolution operation of an oil town and facilties. Resolution of 1m using IKONOS sensor. Provided by GeoEye.",
"size": "33MB",
"data":
{
"name": "Oil",
"url": "https://snxd.akamaized.net/demoassets/earth/GeoEye_Ikonos_Oil_2005NOV25.jpg"
}
},
{
"name": "Mining",
"images": ["https://snxd.akamaized.net/demoassets/earth/GeoEye_Mining_2009FEB14.png"],
"description": "High resolution image of a mining operation from an imaging satellite. Resolution of 50cm provided by GeoEye.",
"size": "47MB",
"data":
{
"name": "Mining",
"url": "https://snxd.akamaized.net/demoassets/earth/GeoEye_Mining_2009FEB14.jpg"
}
},
{
"name": "Agriculture",
"images": ["https://snxd.akamaized.net/demoassets/earth/RapidEye_Altotting_Germany_Agriculture_and_Forestry_2009MAY17.png"],
"description": "High resolution satelitte image of agriculture and forestry in Altötting, Germany. Resolution of 5m provided by RapidEye.",
"size": "56MB",
"data":
{
"name": "Agriculture",
"url": "https://snxd.akamaized.net/demoassets/earth/RapidEye_Altotting_Germany_Agriculture_and_Forestry_2009MAY17.jpg"
}
}
];
$scope.getCartItems = function () {
// Get the items to send to the stamping service
var items = [];
for (var i = 0; i < $scope.items.length; i += 1) {
if ($scope.items[i].checked === true) {
items.push($scope.items[i].data);
}
}
return items;
};
$scope.checkItem = function() {
// Assign disabled css class to download button based on if items selected
var button = angular.element("#multi-download-app button");
if ($scope.getCartItems().length == 0) {
button.prop('disabled', true);
} else {
button.prop('disabled', false);
}
};
$scope.downloadItems = function () {
var directDlm = createDirectDlm();
directDlm.setIdWin("ca2122ce-5519-42fd-8929-8ed739a84cea");
directDlm.setIdMac("9d5104e4-a23d-456c-afcb-7711914145fa");
directDlm.setFilename("MultiDownloadDLM");
directDlm.addItems($scope.getCartItems());
directDlm.download();
};
});
Also see: Tab Triggers