Changing the Font Size and Color

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Image files are very much larger than text files, and take a long time to download. Also, it is much easier to create text than an image.

Changing the Font Size and Color

Your Web page can adjust the size of the font used for a section of text. The following increases the size of the text:

<big> Section of text with new font size.</big>

And you can decrease the size of the text:

<small> Section of text with new font size.</small>

If you want particulary large text do this:

<big><big>Section of text with new font size.</big></big>

To change type color, do this:

<span style="color:red"> Section of text set in red.</span>

Other colors are "black", "blue", "gray", "green", "yellow", and "white". You can combine size and color changes:

<span style="color:red"><big> 
Section of text with new font size and color.
</big></span>

The tags should be properly nested. <big><b> ... </b></big> is properly nested. <big><b> ... </big></b> is not properly nested. Usually browsers work as you expect even with poorly nested tags. Practice these tags in the following:

Insert some font tags, then to see what the HTML does.

QUESTION 17:

There are actually many color names besides the short list mentioned. Guess a few others, "fuchsia", "lightgoldenrodyellow", and "aqua" for instance, and change the tags in the example to see if they work.