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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<title>Quotesy</title>
</header>
<body class="main">
<a class="myTwitterButton" href="http://twitter.com/share?text=test" target="_blank">
<img class='myTwitterButton' src="https://www.freeiconspng.com/uploads/-van-nederland-elgie-gaat-haar-ontwikkeling-posten-op-twitter-24.png"</img>
</a>
<h1 class="center" style="margin-bottom: 0px"><strong>Quotesy</strong></h1>
<p class="center" style="margin-top: 0px"><em>A quote generator</em></p>
<p class="center" style="font-family: 'Gill sans'">Welcome to Quotesy! Whether you're looking for inspiration, are feeling down, or are literally just bored out of your mind, click that GENREATE button and have yourself a good ol' time!
</p>
<button id="generate" class = "center btn btn-primary">GENERATE</button>
</br>
<div class="quoteBox center container-fluid">
<p>A quote will appear here.</p>
</div>
</body>
p{
font-size: 18px;
font-family: 'Gill Sans';
}
h1 {
font-family: "Gill sans";
font-size: 100px;
color: rgb(0,0,0)
}
.center {
text-align: center;
margin-left: auto;
margin-right: auto;
display: block
}
.myTwitterButton{
height: auto;
width: 5%
}
.quoteBox {
margin-left: auto;
margin-right: auto;
display: block;
width: 60%;
background-color: rgba(0,0,0,.6);
color: white;
font-family: "Gill sans"
}
.main {
background-size: cover;
background-image: url('http://res.cloudinary.com/daxueqsh4/image/upload/v1526881194/untitled_1_of_1_-2.jpg');
background-repeat: no-repeat;
background-position: center top;
background-attachment: fixed;
background-width: 100% auto
}
var quote = [
{text: '“It is not the mountain we conquer but ourselves.”', author: "-Sir Edmund Hillary"},
{text: '"Go to heaven for the climate, hell for the company."', author: "-Mark Twain"},
{text: '“Life begins at the end of your comfort zone”', author: "-Neal Donald Walsch"},
{text: '“The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy.”', author:"-Martin Luther King"},
{text:'"Manners maketh man"', author: "-Kingsman"},
{text: '"Move and the way will open"', author: "-Zen Proverb"},
{text: '"Always choose both"', author: "-Steven Jacobs"},
{text: '"Get action!"', author: "-Theodore Roosevelt Sr."},
{text: '"Love never dies"', author: "-unknown"},
{text: '"I remember the first time I had sex - I kept the receipt."', author: "-Groucho Marx"},
{text: '"It is ok to look out for number 1 so long as you don\'t step in number 2!"', author: "-unknown"},
{text: '"What doesn\'t kill you makes you stronger"', author: "-Friedrich Nietzsche"},
{text: '"I am Groot"', author: "-Groot, Guardians of the Galaxy"},
{text: '"Kicking names and taking ass"', author: "-The Waterboy"},
{text: '"You\'re good enough right now. Don\'t wait until tomorrow or three weeks or three years god forbid to put your work out there. Do not compare the place you are at right now to someone else who has been at this game for a long time or to someone else\'s highlight reel. You need to know, the world needs to see and get your work right now."', author: "-Chase Jarvis"},
{text: '"Fear is the path to the dark side. Fear leads to anger. Anger leads to hate. Hate leads to suffering."', author: "-Yoda, Star Wars"},
{text: '"Most people are other people. Their thoughts are someone else\'s opinions, their lives a mimicry, their passions a quotation."', author: '-Oscar Wilde'},
{text: '"Wonders never cease if you never cease to wonder."', author: '-Ziggy'},
{text: '"Get busy livin\' or get busy dying."', author: "-Andy, The Shawshank Redemption"},
{text: '"When you change the way you look at things, the things you look at change."', author: '-Wayne Dyer'},
{text: '"Always remember that you are absolutely unique. Just like everyone else."', author: '-Margaret Mead'},
{text: '“The world is like a ride in an amusement park, and when you choose to go on it you think it\'s real because that\'s how powerful our minds are. The ride goes up and down, around and around, it has thrills and chills, and it\'s very brightly colored, and it\'s very loud, and it\'s fun for a while. Many people have been on the ride a long time, and they begin to wonder, "Hey, is this real, or is this just a ride?" And other people have remembered, and they come back to us and say, "Hey, don\'t worry; don\'t be afraid, ever, because this is just a ride." And we … kill those people.”', author: '-Bill Hicks'},
{text: '"Challenges are what make life interesting; overcoming them is what makes life meaningful"', author: "-Joshua J Marine"}
];
function generate(){
var x = Math.floor(Math.random()*quote.length);
return quote[x];
}
function updateTweet(quote,author){
$('.myTwitterButton').attr("href", "http://twitter.com/share?text=" + quote + " " + author);
}
$(document).ready(function(){
$('#generate').on("click", function(){
var quote = generate();
$('.quoteBox').html('<strong>' + quote.text + '<br/><br/>'+ quote.author + '</strong>');
updateTweet(quote.text, quote.author);
});
});
Also see: Tab Triggers