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.
<div class="list">
<h1>Sofia</h1>
<ul id='sofiaParks'>
</ul>
</div>
<div class="list">
<h1>Marcus</h1>
<ul id='marcusParks'>
</ul>
</div>
<div class="list">
<h1>Jordan</h1>
<ul id='jordanParks'>
</ul>
</div>
<div class="list">
<h1>Everyone</h1>
<ul id='everyoneParks'>
</ul>
</div>
.list{
float:left;
padding-right: 7%;
padding-left: 5%;
}
.list h1{
text-align: center;
}
// In this project, you will use the skills honed thus far to generate lists of public parks with features that appeal to each of your friends
// Your 3 friends enjoy different sports: Sofia enjoys playing tennis, Marcus likes to play basketball, and Jordan likes play soccer.
// Since you've been taking coding for the web and are now a JSON genius, you decide to provide your friends with a personalized list of public parks in Baton Rouge that have courts for their favorite sport
// You use the data provided by Baton Rouge at https://data.brla.gov/resource/asgj-fg6t.json to identify the keys that relate to your friends' favorite sports, and generate their personalized lists according to which parks they can play their sport at
// Additionally, since you enjoy playing all of the sports your friends favor, check to see if there are any parks in which you can meet at to play all 3 of the sports together
// Present the personalized lists of parks to your friends by inserting each list of parks into an unordered HTML list on the web page, with their name in an h1 above their list
// The containers for the lists have already been coded in the HTML pane
// Create variables to access and store the 4 unordered list elements that you will update
// Implement Fetch API to access the json data at the link mentioned above
// Handle the parsed JSON data returned from the fetch in a separate function called assignParks
// In the assignParks function, iterate through each JSON object
// check the park's key:value pairs to see if Sofia, Marcus, or Jordan can practice their sport there
// hint: look at the json data and identify these keys before hand
// note that the objects don't contain the key:value pair if that park does not have the feature,
// for example, not every object has a key:value pair for "outdoor_basketball" because not every park has an outdoor basketball court
// therefore in your if statements, first check if the object even has a pair for the key you're looking for before checking the value for that key
// ex: the if statement for a lighted baseball court would look like this: if (park.baseball_lighted && park.baseball_lighted != "0") { ... }
// note that there are different keys for courts of the same sport that are lighted or unlighted / indoor or outdoor, etc.
// courts that match the 3 friends sports should all be counted (aka it doesnt matter if the park's tennis court is unlit or not, indoor or outdoor, as long as there is that type of court/facility at the park)
// Therefore make sure your if statements are all inclusive by using OR (||); the if statement for a baseball court would then be: if ((park.baseball_lighted && park.baseball_lighted != "0") || (park.baseball_unlighted && park.baseball_unlighted != "0")) {...}
// remember to declare variables to store the content you will place in the unordered lists (think back to the rows variable in 6.5)
// if the if statement results to true, update the variable storing the content to include the new list item (for which the html tag is <li> </li>) containing the name of the park.
// finally, after looping through the data, use the innerHTML function to populate the unordered lists with the appropriate variables storing the content
Also see: Tab Triggers