Pankaj Shah web agency director in London with over 20 years of experience in web design and project management

I hope you enjoy reading our blog posts.

If you want DCP to build you an awesome website, click here.

HTML5 & CSS3 – Beginners Tutorial – Part 9 – [ HTML Form Tags Tutorial ]

This tutorial guides beginners through the process of creating HTML forms using HTML5 and CSS3. It covers essential form elements, including input fields, checkboxes, radio buttons, dropdown menus, and text areas.

The tutorial emphasises the importance of proper coding practices and introduces basic validation techniques. By the end, readers will understand how to structure forms effectively and prepare for further enhancements with CSS and PHP.

Welcome to the ninth part of the Web Designer HTML5 and CSS beginners tutorial. In this tutorial, we will focus on building forms using HTML form tags. Forms are essential for collecting user input on websites, and understanding how to create them is a fundamental skill for web developers.

To get started, open your web browser and Notepad++. Arrange your browser on the left side and Notepad++ on the right. If you don’t see your previous code in Notepad++, open the folder where you saved your HTML file and drag it into Google Chrome to view it. Then, drag it back into Notepad++ to see the code side by side with the web page.

Let’s begin by creating a basic form. First, we will add a horizontal rule to separate our form from the previous content. This can be done using the <hr> tag. Next, we will look at a typical form example from a portfolio website, which includes various input fields such as checkboxes, dropdown menus, and text areas.

Adding the Form Tag

In our code, we will start by adding a <form> tag. The <form> tag is essential as it defines the form and its elements. After adding the form tag, save your work and refresh the browser. You may not see any changes yet, but that’s okay; we are just getting started.

Adding a Heading

Above the form, we will add a heading using the <h2> tag. Let’s call it “Get a Free Quote”. This heading will help users understand the purpose of the form. Remember, the <h1> tag should only be used once per page, while you can use multiple <h2> tags.

Input Fields

Now, we will create input fields for users to enter their information. The first field will be for the user’s name. We will use the <input> tag with the type set to “text”. After saving and refreshing, you should see a field for the first name.

Next, we will add another input field for the last name. Again, ensure you save your changes and refresh the browser to see the updates.

Collecting Contact Information

To gather more information, we will add an input field for the user’s email address. This time, we will set the type to “email”. Using the email type allows for basic validation, ensuring that users enter a valid email format.

Following the email field, we will add another input field for the user’s phone number, also using the text type.

Service Selection

Next, we want to ask users to select a service. We will create a section with checkboxes for different services. Each checkbox will allow users to select one or more services they are interested in. For example, we can include options like “Website Design” and “Graphic Design”. Each checkbox will be created using the <input type=”checkbox”> tag.

Budget Dropdown Menu

To further refine our form, we will add a dropdown menu for users to select their budget. This will be done using the <select> tag, with multiple <option> tags inside it to represent different budget ranges. For example, options could include ranges like “0 to 100”, “100 to 200”, and so on.

Existing Website Question

We will also ask users if they have an existing website. This will be done using radio buttons, which allow users to select only one option. We will create two radio buttons: “Yes” and “No”. To ensure that only one can be selected at a time, both radio buttons must have the same name attribute.

Comments Section

Next, we will add a text area for users to enter any additional comments or messages. This is done using the <textarea> tag. We can specify the number of rows and columns to control the size of the text area. For example, we can set it to 10 rows and 30 columns.

Submit Button

Finally, we need a button for users to submit the form. This is done using the <input type=”submit”> tag. We can customise the button’s text to say “Get a Free Quote”. When users click this button, the form data will be sent for processing.

Form Action and Processing

To make the form functional, we need to specify an action attribute in the <form> tag. This attribute defines where the form data will be sent when submitted. Typically, this would point to a PHP script that processes the data. For demonstration purposes, we can set it to redirect to a specific URL.

Conclusion

In this tutorial, we have covered the basics of creating an HTML form using HTML5 and CSS3. We explored various form elements, including input fields, checkboxes, radio buttons, dropdown menus, and text areas. We also discussed the importance of proper coding practices and introduced basic validation techniques.

As you continue your journey in web development, remember that forms are a crucial part of user interaction on websites. In future tutorials, we will enhance the appearance of our forms using CSS and add functionality with PHP. Stay tuned for more advanced topics!

Author

Picture of Pankaj Shah

Pankaj Shah

Pankaj Shah is the founder of DCP Web Designers, an award-winning London-based web design and digital marketing agency. With over 20 years of experience, he specialises in WordPress web design, WooCommerce, SEO and helping businesses build effective online solutions.
Tell Us Your Thoughts

This website (dcpweb.co.uk) uses cookies to improve your browsing experience and help us understand how our site is used. By continuing to browse this website, you agree to our use of cookies.

To learn more about how we collect, use, and protect your data, please read our Privacy Policy.

Since 2004, we have designed and developed websites for companies across a wide range of industries, from local service businesses to ecommerce brands and professional organisations.

Our focus is on creating websites that not only look professional, but also perform well in search engines, attract the right audience and support long-term business growth.

If you are looking for experienced web designers who understand how to build websites that deliver real results, our team is here to help.

Privacy Policy

Last Updated: 01/07/2024

Different Colour Productions Ltd (“we,” “us,” or “our”) is committed to protecting your privacy. This Privacy Policy outlines our practices concerning the collection, use, and disclosure of personal information when you visit our website or engage with our services. By using our website and services, you consent to the terms outlined in this Privacy Policy.

1. Information We Collect

We collect various types of information to provide and improve our services. The types of information we may collect include:

1.1. Personal Information: This may include your name, email address, phone number, and any other information you provide when you contact us, request information, or subscribe to our newsletter.

1.2. Log Data: When you visit our website, we automatically collect information, such as your IP address, browser type, pages visited, and the time and date of your visit.

1.3. Cookies and Similar Technologies: We use cookies and other tracking technologies to improve your experience on our website. You can adjust your browser settings to reject cookies or be alerted when cookies are being used.

2. How We Use Your Information

We use the collected information for various purposes, including:

2.1. Providing Services: To provide web design and related services you have requested from us.

2.2. Communication: To respond to your inquiries, send updates, and provide customer support.

2.3. Analytics: To analyse and improve our website and services, as well as monitor usage patterns.

3. Information Sharing and Disclosure

We do not sell or rent your personal information to third parties. However, we may share your information with third parties under the following circumstances:

3.1. Service Providers: We may share your information with trusted service providers who help us deliver our services, such as hosting providers, analytics providers, and marketing services.

3.2. Legal Obligations: We may disclose your information when required by law, to comply with legal processes, or to protect our rights, privacy, safety, or property.

4. Your Choices

You have choices regarding your personal information:

4.1. Access and Update: You can access and update your personal information by contacting us.

4.2. Marketing Communications: You can opt out of receiving marketing communications from us by following the unsubscribe instructions in our emails or emailing [email protected]

5. Security

We take appropriate measures to protect your personal information from unauthorised access, disclosure, alteration, or destruction.

6. Links to Other Websites

Our website may contain links to third-party websites. We are not responsible for the privacy practices of these websites. We recommend reviewing their respective privacy policies.

7. Changes to this Privacy Policy

We may update this Privacy Policy from time to time to reflect changes in our practices. Any changes will be posted on this page, and the date at the top will indicate the latest update.

8. Contact Us

If you have any questions or concerns about this Privacy Policy or our practices, please contact us at: [email protected]

By using our website and services, you acknowledge that you have read and agree to this Privacy Policy. Different Colour Productions Ltd is committed to safeguarding your personal information and respecting your privacy rights.

ThreeBestRated Top 3 Website Designers in London 2026 award for DCP Web Designers Certificate