Lab 2: RGB Color Formats for your Web Page
Part 1: Looking up tags
Knowing where to look up information about tags and attributes is important
for several reasons. First, there are so many tags, attributes, and attribute
values that it is impossible to know them all. Second, HTML is constantly changing
so you need to constantly checking to see what is new. In this lab, I would
like you to think of something that you don't know how to do, and to search
around in our textbook and on the web for information that will help you. You
do not need to do anything complicated. For example, try finding out the answer
to to several of the following questions. Use your text and the reference
on the web.
- How do you scale an image (i.e. make it larger, smaller, distorted, etc)
in html?
- How do you change the color of the background or how do you set a background
image?
- How do you create a numbered list of items?
- What are some tags that go in the header that change properties of the entire
page?
- etc
Part 2: Decimal to Binary to Hexadecimal and Back
Practice converting from binary to decimal. For example, you should find that
(try others as well)
- 00100010 (base 2) = 34 (base 10)
- 10000111 (base 2) = 135 (base 10)
Practice converting decimal to binary. Your resulting answer in binary format
should have exactly 8 bits.
- For the numbers above covert back to the original binary.
- 115 (base 10) = 01110011 (base 2)
- 255 (base 10) = ??
Convert the binary numbers above to hexadecimal.
- Convert the number 255 to binary.
- Convert the number 255 from binary to hexadecimal.
- What is the hexadecimal representation for the color red=255, green=0, blue=0?
- Try using this color in your web page. Use the syntax #rrggbb.
- Go into the display properties and pick a color that you really like and
would like to use in your web page. Convert this color to hex and place it
in your web page.
To practice doing conversions, you can check your results using the java
number conversion program.
Part 3: RGB Color Format
As discussed in class, color is often represented as 3 bytes (24 bits). Try
the following
- Using the display panel, choose a color you like. Write down the corresponding
RGB values.
- Convert each of these values from base 10 to binary and then to hex.
- What is the hexadecimal representation for your color?
- Try using this color in your web page. Use the syntax #rrggbb.
- Check the result.
- Repeat again for another color.
[top]
[Syllabus]
[Home]