0% found this document useful (0 votes)
14 views3 pages

HTML5 Exercises for Community Event Portal

The document outlines a series of HTML5 exercises aimed at creating a Local Community Event Portal for a city council. It includes tasks such as setting up a base template, implementing navigation, creating an event registration form, and utilizing geolocation features. Each exercise focuses on different aspects of HTML5, CSS, and JavaScript to enhance user interaction and experience.

Uploaded by

hema22050.ec
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

HTML5 Exercises for Community Event Portal

The document outlines a series of HTML5 exercises aimed at creating a Local Community Event Portal for a city council. It includes tasks such as setting up a base template, implementing navigation, creating an event registration form, and utilizing geolocation features. Each exercise focuses on different aspects of HTML5, CSS, and JavaScript to enhance user interaction and experience.

Uploaded by

hema22050.ec
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML5 Exercises

Project Theme: Local Community Event Portal


A local city council wants a lightweight, browser-based portal to help residents register for
events, check locations, and access basic services.

1. Create the HTML5 Base Template


Scenario: You’re setting up the base document that every page on the portal will use.
Objective: Ensure semantic structure and compatibility across browsers.
Task:
• Use <!DOCTYPE html>, <html lang="en">, <meta charset="UTF-8">
• Add comments to label sections like "Navigation", "Main", "Footer"
• Save as [Link] and open it in Chrome
• Inspect the document structure in Chrome Dev Tools

2. Navigation and Linking


Scenario: Users should navigate between "Home", "Events", and "Contact" sections.
Objective: Provide intuitive navigation and section-based references.
Task:
• Use <nav> with anchor tags <a href="#events">Events</a>
• Define matching IDs for each section like <section id="events">
• Add a link to an external help document using <a href="[Link]" target="_blank">

3. Welcome Message with Styling and ID/Class


Scenario: Display a welcome banner styled uniquely for a logged-in user.
Objective: Practice block/inline tags and differentiate id and class
Task:
• Use <div id="welcomeBanner"> and apply a blue background via internal CSS
• Use inline styles for a special offer <span> (e.g., color red, bold)
• Apply the .highlight class to certain elements for visual emphasis
4. Image Gallery for Community Events
Scenario: Show images from past events in a table layout.
Objective: Work with <img>, tables, and formatting tags.
Task:
• Use a <table> with 2 rows and 3 columns of <img> tags
• Include alt, title, and style each image with borders using a class
• Add a caption to describe each event

5. Event Registration Form


Scenario: Residents need to register for events.
Objective: Practice input types, validation, placeholder, autofocus, and output
Task:
• Include fields: name (text), email (email), date (date), event type (select), message
(textarea)
• Add placeholder, required, and autofocus
• Display a confirmation message using <output> when the form is submitted
• Style the form using CSS

6. Event Feedback with Events Handling


Scenario: Collect real-time feedback and interactions from the user.
Objective: Handle blur, change, click, double-click, and keyboard events.
Task:

• Use onblur to validate a phone number field


• Use onchange on a dropdown to display the selected event fee
• onclick on a submit button to show a confirmation
• ondblclick on an image to enlarge it
• Capture key events in the feedback textarea and count characters

7. Video Invite with Media Events


Scenario: Show a short event promo video.
Objective: Work with <video> and oncanplay event
Task:
• Insert a <video> element with source and controls
• Use oncanplay to display a message like "Video ready to play"
• Use onbeforeunload to warn users if they try to leave the form page unfinished

8. Saving User Preferences


Scenario: Store preferred event type for returning users.
Objective: Work with localStorage, sessionStorage, and deletion
Task:
• Save selected event type in localStorage
• On reload, retrieve and pre-select it
• Add a "Clear Preferences" button that clears both localStorage and sessionStorage

9. Geolocation for Event Mapping


Scenario: Locate the nearest event to the user.
Objective: Practice [Link], error handling, and options
Task:
• Create a button “Find Nearby Events”
• On click, use getCurrentPosition to get and display coordinates
• Handle permission denial and timeouts
• Use high accuracy options

[Link] with Chrome DevTools


Scenario: A few users report layout issues and script errors.
Objective: Use Chrome DevTools and VS Code features to debug.
Task:
• Use “Inspect Element” to modify styles and experiment live
• Use the Console tab to view logs from your <script>
• Add breakpoints in JS and reload the page to watch variable values

Common questions

Powered by AI

Chrome DevTools can be effectively used by employing the "Inspect Element" tool to modify and test styles live, adjusting elements to fix layout issues. The Console tab is crucial for viewing script logs and debugging output from <script> tags. Setting breakpoints in the Sources tab allows developers to examine variable states during page reloads, providing insights into potential errors and solutions .

Challenges of using the Geolocation API include handling user permission denials and location retrieval timeouts. To counter these, provide clear instructions and fallback options. Utilize high accuracy settings for precise location data, and error handling scripts to manage exceptions gracefully. A "Find Nearby Events" button can trigger getCurrentPosition, enhancing user interaction by displaying current coordinates as a basis for nearby event suggestions .

To create a responsive HTML5 image gallery, use a <table> with defined rows and columns (<tr>, <td>) for organizing images. Each <img> tag should include alt text for accessibility and titles for descriptions. Use CSS classes to apply styling such as borders to maintain uniformity. Captions can be added outside each image for context, ensuring that users can understand the event depicted without too much on-screen textual clutter .

To ensure that an HTML5 document maintains semantic structure and cross-browser compatibility, you should use <!DOCTYPE html> to define the document type, <html lang="en"> to specify the language, and <meta charset="UTF-8"> for character encoding. Additionally, using comments to label sections like "Navigation", "Main", and "Footer" can improve clarity and maintainability .

In HTML5, IDs are used for unique single-element styling, while classes can be applied to multiple elements. For instance, a welcome banner can be styled uniquely with <div id="welcomeBanner"> and a blue background through internal CSS. Contrastingly, the .highlight class can be applied to multiple elements for consistent visual emphasis. Inline styles, such as styling a <span> for a special offer with red color and bold text, offer further specific adjustments .

To create intuitive navigation in an HTML5 portal, incorporate a <nav> element with anchor tags linked to section IDs, such as <a href="#events">Events</a>. This structure facilitates easy and accessible navigation between sections like "Home", "Events", and "Contact". Additionally, including external links with target="_blank" for help documents can enhance navigation by providing resources without disrupting the user's current session .

localStorage enhances user experience by storing user preferences persistently across sessions. In event applications, it can save a user's selected event type, which can be retrieved and pre-selected when the user returns, providing a personalized and convenient interaction. Clearing options can be handled with a "Clear Preferences" button that simultaneously purges both localStorage and sessionStorage, ensuring user control over their data .

To enhance user interaction, implement event handlers such as onblur to validate phone numbers, onchange to update event fee displays based on dropdown selections, and onclick to confirm submission. An ondblclick event can enlarge images, providing more interaction depth. Additionally, capturing key events in the feedback textarea allows for real-time character count updates, improving user feedback and data accuracy .

Basic client-side form validation in HTML5 involves using input attributes like required, placeholder, and specific types such as email for email fields and date for date fields. The autofocus attribute can help guide user input efficiently. Additionally, an <output> element can be used to display a confirmation message upon form submission, enhancing user feedback and interaction .

Seamlessly integrating video content involves using the <video> element with essential attributes like controls and source specifications. Javascript events like oncanplay are useful for triggering messages such as "Video ready to play" upon video readiness, enhancing user engagement. Additionally, implementing an onbeforeunload event can prompt users about unfinished forms, improving user experience and data retention .

You might also like