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.
<!--
i have lots of comments in this code, feel free to delete them if you already know what you're doing. i just wanted to make sure that everyone, even those who don't really know code very well, can use this menu to make their sites more accessible to everyone. :)
the most important thing to do when learning code is to play around with everything! codepen is great for this. break things, fix things, do whatever! -->
<!--regular content, not a part of the menu-->
<h1>accessibility menu</h1>
<h2>made by <a href="https://cybr.gay">cyberponiez</a>!</h2>
<p>this menu is highly customizable. i've left some comments within the code to make it easier to edit!</p>
you can:<ul>
<li>change the menu icon</li>
<li>change the style of the buttons</li>
<li>add more options to each category</li>
<li>add more categories</li>
<li>and more!</li>
</ul>
<!--the button in the bottom right of the page that opens the menu when clicked on--><div id="accButton"></div>
<!--the menu itself, it is hidden by default because it had the "hidden" class. you can find the class itself inside of the css. removing this class will make the menu no longer hidden.--><div id="popMenu" class="hidden">
<button><a href="insertYourSiteUrlHere">reset all</a></button>
<button id="closeButton">close</button>
<h1>accessibility options</h1>
<h2>text color</h2>
<button onclick="changeTextColor('blue')">blue (default)</button>
<button onclick="changeTextColor('white')">white</button>
<button onclick="changeTextColor('black')">black</button>
<h2>background style</h2>
<button onclick="changeBackgroundImage('https://cybr.gay/images/bgblackgalaxy.gif')">black galaxy (default)</button>
<button onclick="changeBackgroundImage('https://cybr.gay/images/bgbluegalaxy3.gif')">blue galaxy</button>
<button onclick="changeBackgroundImage('https://cybr.gay/images/bgblueclouds.png')">white clouds</button>
<h2>text size</h2>
<button onclick="changeFontSize('10')">smaller</button>
<button onclick="changeFontSize('16')">regular (default)</button>
<button onclick="changeFontSize('20')">bigger</button>
<button onclick="changeFontSize('25')">biggest</button>
<h2>font</h2>
<button onclick="changeFont('Times New Roman')">times new roman (default)</button>
<button onclick="changeFont('OpenDyslexic')">open dyslexic</button>
<button onclick="changeFont('Arial')">arial</button>
<h2>link color</h2>
<button onclick="changeAnchorColor('blue')">blue (default)</button>
<button onclick="changeAnchorColor('purple')">purple</button>
<button onclick="changeAnchorColor('green')">green</button>
</div>
/* you can change or add pretty much any font that you want, just have the url for it if it's not one of the default web fonts.*/
@font-face {
font-family: OpenDyslexic;
src: url(https://cybr.gay/font/OpenDyslexic.otf);
}
/* this is the default state for all elements unless they are otherwise specified in their own classes. you probably have your own body style already, for your own website. */
body {
color: blue;
background-color: pink;
background-image: url("https://cybr.gay/images/bgblackgalaxy.gif");
font-family: "Times New Roman", Times, serif;
}
/* the default style for links. */
a {
color:blue;
}
/* this is the button in the bottom right of the page that opens up the menu. notice how the name of the id corresponds to the div inside of the html. you can change the size, image, or anything else about the button. */
#accButton {
background-color: transparent;
width: 100px;
height: 100px;
background-image: url("https://cybr.gay/images/baccessicon2.png");
background-size: 100%;
background-repeat: no-repeat;
position: fixed;
bottom: 30px;
right: 30px;
}
/* this is what the button looks like when it is hovered over. personally, i made an image that is a different color (in this case, white) but you can change the image to whatever you want, or you can erase this class completely if you don't want a hover effect. */
#accButton:hover {
background-image: url('https://cybr.gay/images/waccessicon2.png');
}
/* this is the "close" button at the top of the menu. */
#closeButton {
position: static;
}
/* this is the menu itself. there are lots of things you can change. */
#popMenu {
text-align: center;
position: absolute;
right: 20px;
bottom: 135px;
width: 27em;
height: 25em;
overflow: auto;
background: #9C27B0;
color: white;
padding: 10px;
margin: 10px;
border: 5px double white;
background-image: url("https://cybr.gay/images/bgbluegalaxy3.gif");
}
/* this is the style of the buttons (the ones that have the options, like black, white, etc) and you can obv change whatever you want about them. */
button {
background-color: #3498db;
color: white;
border: 3px outset #3498db;
padding: 10px 10px;
margin: 0.25em;
font-size: 16px;
cursor: pointer;
}
/* this is what the buttons look like when they are "active", in this case when they are being actively clicked. feel free to delete if you don't want this effect. */
button:active {
background-color: #236592;
border: 3px inset #236592;
color: #a6a6a6;
}
/* this is what makes the menu hidden by default. i don't reccomend touching it */
.hidden {
display: none;
}
// buttons to change
function changeParagraphStyle() {
var paragraphs = document.getElementsByTagName('p');
for (var i = 0; i < paragraphs.length; i++) {
}
}
function changeTextColor(color) {
document.body.style.color = color;
}
function changeFont(font) {
document.body.style.fontFamily = font;
}
function changeFontSize(size) {
document.body.style.fontSize = size + 'px';
}
function changeBackgroundImage(image) {
document.body.style.backgroundImage = "url('" + image + "')";
}
//link colors
function changeAnchorColor(color) {
var anchors = document.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++) {
anchors[i].style.color = color;
}}
// button to open menu
const accButton = document.getElementById('accButton');
const popMenu = document.getElementById('popMenu');
const closeButton = document.getElementById('closeButton');
accButton.addEventListener('click', function() {
popMenu.classList.toggle('hidden');
});
closeButton.addEventListener('click', function() {
popMenu.classList.add('hidden');
});
Also see: Tab Triggers