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 lang="en">
<head>
<meta charset="UTF-8">
<title>Inspirational Quote of the Day</title>
<link rel="stylesheet" href="quote.css">
<link href='https://fonts.googleapis.com/css?family=Roboto:800,700' rel='stylesheet' type='text/css'>
<script src="jquery-1.11.2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<h2>Gerry says:</h2>
<div id="quoteContainer">
<p></p>
<p id="quoteGenius"></p>
</div><!--end quoteContainer-->
<div id="buttonContainer">
<a href="#" id="quoteButton">Enlighten Me</a>
</div><!--end buttonContainer-->
</div><!--end container-->
</body>
</html>
body{
font-family: 'Roboto', sans-serif;
color: #000;
}
#container{
width:800px;
margin:50px auto;
padding: 20px;
width:50%;
}
#container h2{
text-align:center;
color:#045;
}
#quoteContainer{
width:75%;
background: #fff;
padding:10px;
margin:30px auto;
text-align: center;
height:70px;
}
#buttonContainer{
width: 100%;
text-align: center;
}
#quoteButton{
width:200px;
margin-top: 10px;
border:2px solid #46b8da;
color:#045;
font-family: inherit;
font-weight: bold;
padding:5px;
text-decoration: none;
text-align: center;
}
#quoteButton:hover{
cursor:pointer;
background:#09c;
color: #fff;
}
#quoteButton:active{
cursor: pointer;
}
#quoteButton{
display: inline-block;
}
#quoteGenius{
font-style: italic;
font-weight: 600;
text-align: center;
}
/*MEDIA QUERIES*/
@media screen and(max-width:760px){
#quoteButton,#addNew{
display: block;
}
}
$(document).ready(function(){
var quoteSource=[
{
quote: "Japanese people can make anything out of a tin can.",
name:"Gerry Bardouche"
},
{
quote:"Belgians eat too many potatoes and too much bread.",
name:"Gerry Bardouche"
},
{
quote:"Dentists are dirty bastards.",
name:"Gerry Bardouche"
},
{
quote:"Italians smell funny.",
name:"Gerry Bardouche"
},
{
quote:"People shouldn't walk on the grass in Hawaii.",
name:"Gerry Bardouche"
},
{
quote:"Tourists are an annoyance to the natives of an area.",
name:"Gerry Bardouche"
},
{
quote:"Women don't like leftovers.",
name:"Gerry Bardouche"
},
{
quote:"Your car will never break down in 80º weather in front of a nudist colony; instead it will break down in freezing weather in front of a leper colony.",
name:"Gerry Bardouche"
},
{
quote:"Every nationality has its own smell.",
name:"Gerry Bardouche"
},
{
quote:"A church is a place of rest and a building in which one can analyze its heating, cooling and air circulation system.",
name:"Gerry Bardouche"
},
{
quote:"When removing roofing tiles, one must be careful not to remove your ladder from the side of the house.",
name:"Gerry Bardouche"
},
{
quote:"Children's school programs are not meant for old farts ready to croak.",
name:"Gerry Bardouche"
},
{
quote:"The reason my wife doesn't mind slaving over a hot stove every day is because she gets to sleep with the master of the house.",
name:"Gerry Bardouche"
},
{
quote:"If you tap Standard Oil, they will tap your pocket.",
name:"Gerry Bardouche"
},
{
quote:"Sobiski Corners (Wisconsin), is the center of the universe.",
name:"Gerry Bardouche"
},
{
quote:"The best alarm clock is a shotgun.",
name:"Gerry Bardouche"
},
{
quote:"Why do people want to shut down nuclear power plants when no one has died as a result of one? People die from cars and snowmobiles all the time and no one wants to ban them.",
name:"Gerry Bardouche"
},
{
quote:"We like boiled fish, but we don’t like to catch them that way. Boiled fish do, however, like the saunas created by nuclear power plants.",
name:"Gerry Bardouche"
},
{
quote:"It’s not worthwhile stopping to pick up aluminum cans on the side of the road.",
name:"Gerry Bardouche"
},
{
quote:"You can’t salvage lettuce when you’re being paid peanuts.",
name:"Gerry Bardouche"
},
{
quote:"One doesn't pull trailers with a Porsche.",
name:"Gerry Bardouche"
},
{
quote:"A bathroom is a place where, when sitting down, one can analyze the fixtures, walls and floor for imperfections.",
name:"Gerry Bardouche"
},
{
quote:"Standing on a scale, or looking at yourself in a full length mirror will give you incentive to do a few 'push-aways' at the dinner table...I fight it though.",
name:"Gerry Bardouche"
},
{
quote:"You can't play cards at the funeral home.",
name:"Gerry Bardouche"
},
{
quote:"When one gets to be a certain age, pleasure is obtained by searching the obituaries for deceased friends.",
name:"Gerry Bardouche"
},
{
quote:"Women like to play Yahtzee.",
name:"Gerry Bardouche"
},
{
quote:"Don't engage in the use of profanity when the distance between you and your grandmother is occupied by water.",
name:"Gerry Bardouche"
},
{
quote:"It's the greatest thing in the world to have beer in cans.",
name:"Gerry Bardouche"
},
{
quote:"With the use of a lunch bag, one can construct a cheap Michael Jackson glove. (Remember, it was 1985)",
name:"Gerry Bardouche"
},
{
quote:"I like music from those blind colored boys.",
name:"Gerry Bardouche"
},
{
quote:"Instead of stealing hub caps when I was young I stole garbage can covers.",
name:"Gerry Bardouche"
},
{
quote:"If you want to find someone’s IQ, it is inversely proportional to the velocity at which they leave the school parking lot.",
name:"Uncle Gerry"
},
{
quote:"The closer you are to the lunatic fringe, the larger a stereo you have.",
name:"Professor Bardouche"
},
{
quote:"Your social stature is directly proportional to the amount of trash on your curb on garbage day.",
name:"Mr. Bardouche"
},
{
quote:"The farther away from a house you are, the easier it is to steal produce.",
name:"Gerald Bardouche"
},
{
quote:"It's OK to shoot an animal (opossum, dog, cat, human, etc.) that chases your cattle or goes into your barn.",
name:"Mr. B."
},
{
quote:"The human race is divided into two different animal kingdoms. There are those who inherit a whole bunch of money from aunt Mildred and go on to major in surfing at the University of Miami; then there are those like me who have to go to the local cow college and work for a living.",
name:"Gerry Bardouche"
},
{
quote:"In order to be an artist, one must speak a foreign language.",
name:"Doctor Professor Gerry"
},
{
quote:"If you are a frogman and you are trying to blow up pilings and someone throws a grenade at you, you will need about four tubes of Preparation-H.",
name:"Gerry Bardouche"
},
{
quote:"If you have a lonely puppy (or a big ego) go buy a mirror.",
name:"G. Bardouche"
},
{
quote:"All artists are fur-faces.",
name:"Uncle Gerry"
},
{
quote:"When I retire I’m gonna be happy...and so are you.",
name:"Gerry Bardouche"
},
{
quote:"People who have had cataract surgery shouldn't look at the sun for fear of burning two holes in their head.",
name:"Gerry Bardouche"
},
{
quote:"I buy green clothes because they look like money.",
name:"Lt. Col. Bardouche"
},
{
quote:"I don't know why my kids don't run away...I give them every chance.",
name:"Father Bardouche"
},
{
quote:"The three best things about teaching are June, July and August.",
name:"Capt'n Bardouche"
},
{
quote:"Instead of giving someone a raise, give them a hard-hat with their name on it, or a key to the bathroom.",
name:"Gerry 'El Presidente' Bardouche"
},
{
quote:"The first requirement for being a doctor is a refrigerated stethoscope.",
name:"Uncle Gerry"
},
{
quote:"'I' before 'E' except after 'V'. Thats why we spell review, R E V E I W.",
name:"Right Reverend Bardouche"
},
{
quote:"If there is a homosexual in the neighborhood, you'll make it a point to tell others about them.",
name:"Gerry B."
},
{
quote:"Down south, if you go into a store you'll find sunscreen for the whites and hair straighteners for the blacks.",
name:"Emperor Bardouche"
}
];
$('#quoteButton').click(function(evt){
//define the containers of the info we target
var quote = $('#quoteContainer p').text();
var quoteGenius = $('#quoteGenius').text();
//prevent browser's default action
evt.preventDefault();
//getting a new random number to attach to a quote and setting a limit
var sourceLength = quoteSource.length;
var randomNumber= Math.floor(Math.random()*sourceLength);
//set a new quote
for(i=0;i<=sourceLength;i+=1){
var newQuoteText = quoteSource[randomNumber].quote;
var newQuoteGenius = quoteSource[randomNumber].name;
//console.log(newQuoteText,newQuoteGenius);
var timeAnimation = 500;
var quoteContainer = $('#quoteContainer');
//fade out animation with callback
quoteContainer.fadeOut(timeAnimation, function(){
quoteContainer.html('');
quoteContainer.append('<p>'+newQuoteText+'</p>'+'<p id="quoteGenius">'+'- '+newQuoteGenius+'</p>');
//fadein animation.
quoteContainer.fadeIn(timeAnimation);
});
break;
};//end for loop
});//end quoteButton function
});//end document ready
Also see: Tab Triggers