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.
<html ng-app="modalTest">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js" type="text/javascript"></script>
<script src="https://m-e-conroy.github.io/angular-dialog-service/javascripts/dialogs.min.js" type="text/javascript"></script>
</head>
<body ng-controller="dialogServiceTest" class="pad">
<h2>Bootstrap 3 & AngularJS Dialog/Modals</h2><br />
<p>
Demostration of my Angular-Dialog-Service module. Which can be found on Github: <a href="https://github.com/m-e-conroy/angular-dialog-service">https://github.com/m-e-conroy/angular-dialog-service</a><br />
</p>
<div class="row">
<div class="col-md-12">
<button class="btn btn-danger" ng-click="launch('error')">Error Dialog</button>
<button class="btn btn-primary" ng-click="launch('wait')">Wait Dialog</button>
<button class="btn btn-default" ng-click="launch('notify')">Notify Dialog</button>
<button class="btn btn-success" ng-click="launch('confirm')">Confirm Dialog</button>
<button class="btn btn-warning" ng-click="launch('create')">Custom Dialog</button>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<p>
<span class="text-info">From Confirm Dialog</span>: {{confirmed}}
</p>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<p>
<span class="text-info">Your Name</span>: {{name}}
</p>
</div>
</div>
<br />
<p>
<a href="https://michaeleconroy.blogspot.com/2013/10/redux-creating-application-dialog.html" target="_top"><strong>View My Blog Post</strong>: Redux: Creating an Application Dialog Service using AngularJS, Twitter Bootstrap & Angular UI-Bootstrap</a>
</p>
</body>
</html>
/* Fix for Bootstrap 3 with Angular UI Bootstrap */
.modal {
display: block;
}
/* Custom dialog/modal headers */
.dialog-header-error { background-color: #d2322d; }
.dialog-header-wait { background-color: #428bca; }
.dialog-header-notify { background-color: #eeeeee; }
.dialog-header-confirm { background-color: #333333; }
.dialog-header-error span, .dialog-header-error h4,
.dialog-header-wait span, .dialog-header-wait h4,
.dialog-header-confirm span, .dialog-header-confirm h4 { color: #ffffff; }
/* Ease Display */
.pad { padding: 25px; }
angular.module('modalTest',['ui.bootstrap','dialogs'])
.controller('dialogServiceTest',function($scope,$rootScope,$timeout,$dialogs){
$scope.confirmed = 'You have yet to be confirmed!';
$scope.name = '"Your name here."';
$scope.launch = function(which){
var dlg = null;
switch(which){
// Error Dialog
case 'error':
dlg = $dialogs.error('This is my error message');
break;
// Wait / Progress Dialog
case 'wait':
dlg = $dialogs.wait(msgs[i++],progress);
fakeProgress();
break;
// Notify Dialog
case 'notify':
dlg = $dialogs.notify('Something Happened!','Something happened that I need to tell you.');
break;
// Confirm Dialog
case 'confirm':
dlg = $dialogs.confirm('Please Confirm','Is this awesome or what?');
dlg.result.then(function(btn){
$scope.confirmed = 'You thought this quite awesome!';
},function(btn){
$scope.confirmed = 'Shame on you for not thinking this is awesome!';
});
break;
// Create Your Own Dialog
case 'create':
dlg = $dialogs.create('/dialogs/whatsyourname.html','whatsYourNameCtrl',{},{key: false,back: 'static'});
dlg.result.then(function(name){
$scope.name = name;
},function(){
$scope.name = 'You decided not to enter in your name, that makes me sad.';
});
break;
}; // end switch
}; // end launch
// for faking the progress bar in the wait dialog
var progress = 25;
var msgs = [
'Hey! I\'m waiting here...',
'About half way done...',
'Almost there?',
'Woo Hoo! I made it!'
];
var i = 0;
var fakeProgress = function(){
$timeout(function(){
if(progress < 100){
progress += 25;
$rootScope.$broadcast('dialogs.wait.progress',{msg: msgs[i++],'progress': progress});
fakeProgress();
}else{
$rootScope.$broadcast('dialogs.wait.complete');
}
},1000);
}; // end fakeProgress
}) // end dialogsServiceTest
.controller('whatsYourNameCtrl',function($scope,$modalInstance,data){
$scope.user = {name : ''};
$scope.cancel = function(){
$modalInstance.dismiss('canceled');
}; // end cancel
$scope.save = function(){
$modalInstance.close($scope.user.name);
}; // end save
$scope.hitEnter = function(evt){
if(angular.equals(evt.keyCode,13) && !(angular.equals($scope.name,null) || angular.equals($scope.name,'')))
$scope.save();
}; // end hitEnter
}) // end whatsYourNameCtrl
.run(['$templateCache',function($templateCache){
$templateCache.put('/dialogs/whatsyourname.html','<div class="modal"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h4 class="modal-title"><span class="glyphicon glyphicon-star"></span> User\'s Name</h4></div><div class="modal-body"><ng-form name="nameDialog" novalidate role="form"><div class="form-group input-group-lg" ng-class="{true: \'has-error\'}[nameDialog.username.$dirty && nameDialog.username.$invalid]"><label class="control-label" for="username">Name:</label><input type="text" class="form-control" name="username" id="username" ng-model="user.name" ng-keyup="hitEnter($event)" required><span class="help-block">Enter your full name, first & last.</span></div></ng-form></div><div class="modal-footer"><button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button><button type="button" class="btn btn-primary" ng-click="save()" ng-disabled="(nameDialog.$dirty && nameDialog.$invalid) || nameDialog.$pristine">Save</button></div></div></div></div>');
}]); // end run / module
Also see: Tab Triggers