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.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>survey form</title>
</head>
<body>
<h1 id="title">Songafarmer Survey Form</h1>
<p id="description">Dear farmer, kindly take your time to participate in this survey form , your feedback will help us to serve you better.</p>
<form id="survey-form">
<div class="form-control">
<label for="name" id="name-label"> Name:</label>
<input type="text" id="name" placeholder="Enter your Name" required>
</label>
</div>
<div class="form-control">
<label for="email" id="email-label">Email:</label>
<input type="email" id="email" required placeholder="Enter your Email">
</div>
<div class="form-control">
<label for="phone number" id=" phone-label">Tel Number:</label>
<input type="tel" id="tel" required placeholder="Enter Tel Number">
</div>
<div class="form-control">
<label for="age" id="number-label" >Age:</label>
<input type="number" id="number" min="18" max="70" placeholder="Age" >
</div>
<div class="form-control">
<label for="date" id="date-label">Year of Birth:</label>
<input type="date" id="date" required>
</div>
<p>Choose Your Farming Category</p>
<div class="form-control">
<select id="dropdown" >
<option disabled="" selected="" value="">Select an option</option>
<option value="poultry farming">Poultry Farming</option>
<option value="vegetable farming">Vegetable Farming</option>
<option value="fruit farming ">Fruit Farming</option>
<option value="bee keeping">Bee Keeping</option>
<option value="dairy farming">Dairy Farming</option>
<option value="fish keeping">Fish Farming</option>
<option value="beef keeping">Beef Keeping</option>
<option value="others">Others</option>
</select>
</div>
<p>Would you recommend songafarmer to your fellow farmers?</p>
<div class="form-control">
<label for="radio">Definately</label>
<input type="radio" id="radio" value="definaltety" name="recommend">
</div>
<br>
<div class="form-control">
<label for="radio">Maybe</label>
<input type="radio" id="radio" value="maybe" name="recommend">
</div>
<br>
<div class="form-control">
<label for="radio">Not Sure</label>
<input type="radio" id="radio" value="not sure" name="recommend">
</div>
<br>
<p>Choose Your Best songafarmer feature</p>
<div class="form-control">
<select id="dropdown" class="form-control" >
<option disabled="" selected="" value="">Select an option</option>
<option value="market alerts">Market Alerts</option>
<option value="weather updates">Weather Updates</option>
<option value="news">News</option>
<option value="chat forum">Chat Forum</option>
<option value="recipe">Recipe</option>
<option value="inspiration">Inspiration</option>
</select>
</div>
<p>Which feature should songafarmer improve to make your experience better?(Check all that apply)</p>
<div class="form-control">
<label for="checkbox">Market Alerts</label>
<input type="checkbox" id="checkbox" value="market alerts">
</div>
<div class="form-control">
<label for="checkbox">Weather Updates</label>
<input type="checkbox" id="checkbox" value="weather updates">
</div>
<div class="form-control">
<label for="checkbox">News</label>
<input type="checkbox" id="checkbox" value="news">
</div>
<div class="form-control">
<label for="checkbox">Chat Forum</label>
<input type="checkbox" id="checkbox" value="chat forum">
</div>
<div class="form-control">
<label for="checkbox">Recipe</label>
<input type="checkbox" id="checkbox" value="recipe">
</div>
<div class="form-control">
<label for="checkbox">Inspiration</label>
<input type="checkbox" id="checkbox" value="inspiration">
</div>
<p>Any comments or suggestions?</p>
<div class="form-control">
<textarea placeholder="Enter your comments here..."></textarea>
</div>
<button class="submit-button" id="submit">Submit</button>
</form>
<footer>©songafarmer 2022</footer>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js">
</script>
</body>
</html>
/* Styling the Body element i.e. Color,
Font, Alignment */
body {
background-color: #05c46b;
font-family: Verdana;
text-align: center;
}
/* Styling the Form (Color, Padding, Shadow) */
form {
background-color: #fff;
max-width: 500px;
margin: 50px auto;
padding: 30px 20px;
box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.5);
}
/* Styling form-control Label */
.form-control label{
display: block;
margin-bottom: 10px;
}
/* Styling form-control input,
select, textarea */
.form-control input,
.form-control select,
.form-control textarea {
border: 1px solid #777;
border-radius: 2px;
font-family: inherit;
padding: 10px;
display: block;
width: 95%;
}
/* Styling form-control Radio
button and Checkbox */
.form-control input,
.form-control label {
display: inline-block;
width: auto;
margin-bottom:20px;
vertical-align: middle;
margin-top:20px;
}
/* Styling Button */
button {
background-color: #05c46b;
border: 1px solid #777;
border-radius: 2px;
font-family: inherit;
font-size: 21px;
display: block;
width: 100%;
margin-top: 50px;
margin-bottom: 20px;
font-weight:bold;
cursor:pointer;
}
footer{
font-weight:bold;
}
Also see: Tab Triggers