Midterm Exam 1

Part 1: Short Answer

Provide short answers to the following questions (one sentence or phrase each). Each question is worth one point, for a total of five points.

  1. class and id are possible attributes for an HTML element. What is the primary difference between them?
  2. What are the three places we can place CSS code for our web pages?
  3. List one reason it is valuable to use semantic markup such as main and nav in our HTML, rather than simply write bare paragraphs or use generic elements such as div?
  4. In CSS, every HTML element can be thought of as a box. What are the four components of the box, from the inside out?
  5. What is the difference between the Internet and the World Wide Web?

Part 2: Label Parts

Identify an example of each label in the associated piece of code. Each label is worth one point, for a total of nine points.

  1. Labels:    attribute     element     entity     tag     value
    <aside id="disclaimer">
      All content on this page is &copy; 2024
    </aside>
    
  2. Labels:    declaration     property     selector     value
    #disclaimer {
      background-color: lightgray;
      border: 1px dotted black;
    }
    

Part 3: Find Errors

Identify three errors in each piece of code. Provide a very short description of the error (one phrase each). Each error is worth one point, for a total of six points.

  1. You may assume that this snippet is in an otherwise valid html element.
    <body>
      <h1>Hello World!</h1>
      <p>
        Welcome to <div class=bold">my first web page</span>.
        I will write many more.
    </body>
    
  2. You may assume that this snippet is in an otherwise valid CSS file.
    .page-header {
      border-bottom: solid, rgb(100, 100, 100), 5px;
      overflow: auto;
      margin-top:
      margin-bottom: 20px;
      padding-bottom: 5px
    }
    

Part 4: Write Code

For each question, write the requested code. Each question is worth five points.

  1. Write HTML code for a link to a file named alan-kay.html in the folder speakers, with Alan Kay as the content.
  2. Write HTML code to create this content with an ordered list:

    James Bond

    1. Sean Connery
    2. Roger Moore
    3. Daniel Craig
    Do not worry about the styling. Write only the HTML code for the content.
  3. Write HTML code to create a table that looks like this:
    NamePhone number
    Eugene Wallingford319-273-5919
    Do not worry about the styling. Write only the HTML code for the content.
  4. Write CSS code to style a paragraph with 16-point, sans-serif font and a left margin of 1em.
  5. Write CSS code to style a link so that its text is green and there is no underline (decoration).
  6. Write CSS code to style an image so that it is 400px wide, has a 1px solid black border, 10px of space inside the border, and 25px of space above and below it. Include alt text of your choice.

That is all!