HTML Document Formatting

In this lab, you will be formatting a text document as an HTML version of this PDF. (Ignore the page break in the middle of that PDF, since HTML pages don't have page breaks.) All of the text content is provided in the starter code below. You just need to format the document as HTML.


Starting Code

Use the provided lab2.txt to avoid copying and pasting large chunks of text. Lines beginning with # are intended as guidelines, and should be converted into HTML comments.


Step 1: Basic HTML Documents

Your task is to add HTML elements to the provided text file to create the document structure. Note that the PDF was generated using a word processor and we are only using HTML. As such, some appearances (fonts, spacing, etc.) may not be exactly the same. You should try to make it as close as possible, however.

For this step, you need to have a correctly formatted header to create a valid HTML file. You also need to format all paragraphs and lists correctly.


Step 2: HTML Document Structure

Once you have all the previous components, you need to add the remaining HTML elements, such as the title, subtitle, and horizontal lines. You also need to add the JMU logo image at the bottom. The only things that should be missing at this point are the portions controlled by JavaScript.


Step 3: JavaScript Fundamentals

Once you have added the required HTML elements, you will need to add JavaScript code in a few places. Each of these will require a separate <script> tag:

  • Just after the <body> tag, create the variables as described in the lab2.txt file.
  • Use one variable as a Boolean to determine whether or not to show the JMU logo image at the bottom.
  • Use the other variables as Strings that contain both the level 3 heading tags and the corresponding text.

Submission

Your code must adhere to the CS 343 Style Guide. In addition to the formatting of your source code itself, your submission must also validate cleanly with no errors or warnings.

Note that publishing your file is not necessarily to test validation. The easiest way to test validation is to install a browser extension/add-on. Search in your browser's extension tool for "HTML Validator" (by Marc Gueury). You can also copy and paste the HTML into the validator itself (selecting the "text input" from the "Check by" drop-down list).

You will submit your lab2.html file to Gradescope for submission. You should not publish your code to w3stu, as that makes it public for all to copy from.



James Madison University logo


© 2011-2024 Michael S. Kirkpatrick.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.