Website Development I

Course Info Class Notes Resources Student Websites

Class No. 6:

Extensive Control of Text

To add class and id attributes to HTML elements and use those as CSS selectors.

Web Programming book reading for THIS class

Web Programming book reading for NEXT class

Additional References


Review

Questions from our last class or the readings?


Text Properties

Text Alignment


Dean, Web Programming, p. 109

Dean, Web Programming, p. 109

Text Transformation


Dean, Web Programming, p. 110

Paragraph Spacing


Dean, Web Programming, fig. 3.18, p. 108

Control of Text Spacing (with a quote from Defense Attorney Bryan Stevenson)

Indentation

Pseudo-Elements


Today’s Exercise

Goal:  To continue working with CSS and to see how an element’s rendering can be changed dynamically.

Procedure:

    Step 1:  Understand what you are to do

  1. Look at the code in Figure 3.21 on page 116 of our textbook.
  2. Run this code by clicking here.
    • If you’re reading these instructions on paper, go to the class website on your computer to find the clicking here link above and click it.
  3. Note that the page looks just like Figure 3.20 on page 115.
  4. Now click either the HOT or COLD button and note what happens.  Click the button again to see what happens next.  Do the same with the other button.  This exercise will lead you through adding a third button that behaves similarly.
  5. Open the UltraEdit editor on your computer.  This should open a blank window that is ready for editing.
    • If your editor is already open, click File and then New to open a blank window.
  6. Leave the editor open and return to the page you were just experimenting with in your Microsoft Edge browser.
  7. As we have done previously, type CtrlU to view the source code for the starter code page.
  8. Click anywhere in the browser window and type CtrlA to select all of the code.
  9. Type CtrlC to copy the code.
  10. Return to UltraEdit and type CtrlV to paste the code into the blank editor window.
  11. Type CtrlS to save your copy of the starter code to your dropbox.  Name the file as you see fit.
  12. Open the file you just saved in Microsoft Edge to ensure that you have saved it correctly.
  13. Study the code and work to add a button labeled WARM between the HOT and COLD buttons.
    • Use green as the initial background color of your WARM button.
    • To do this you need to add code to both the body and style sections of the page.
  14. Look at the Toggle function and see if you can figure out how to add the same functionality to your new WARM button that exists for the HOT and COLD buttons.
  15. Now that you thoroughly understand how this web page is implemented, think about how you could adapt it to create an online menu.  Here is the basic idea:
    • Each menu item should be listed on a line by itself, preceded by a round button that the user can click.
    • Hamburger
      Cheeseburger
      Hot Dog
      French Fries
      Cole Slaw
    • If the button has a red background, the item has not been selected.
      • Thus, all buttons should initially have red backgrounds.
    • If the button has a green background, the item has been selected.
  16. Here is some code to help you get started.
  17.       .label {
            background-color: red;
            border-radius: 50%;
            padding-left: 0.6em; 
            padding-right: 0.6em;
            margin-right: 0.5em;
          }
        
          <span class="label" onclick="Toggle( this )"></span> Hamburger<br>


 


This is Class No. 6.  It was last modified on Saturday, October 21, 2023 at 4:38 PM.  Copyright © 2010-2024 by Jesse M. Heines.  All rights reserved, but may be freely copied or excerpted for educational purposes with credit to the author.