HCI201 -- Lecture 4
Review/Discussion Questions
- What are five rules that an XHTML document must satisfy?
Ans: (1) A start tag requires a matching end tag, (2) Tags must be nested, (3) A combination start/end tag is allowed for tags that have nothing between the start and end tag, (4) Double quotes are required for the value of a tag attribute, (5) Header lines are needed to show the version of XHTML that is used.
- Write an inline style for a size 1 heading that specifies
purple text, Chiller font that is in bold, centered and three times as large
as normal. So it would look like this review_q2
Ans:
<body style="font-family:Chiller; font-weight:bold;
text-align:center; font-size:300%;
color: purple"> - What are the HTML special symbols (character entities) used to
display the following in a browser:
< > & "
Ans: < > & " - How many spaces does the browser display between
a and b (see below)? Recall that the browser eliminates all but one
of the normal spaces between words. Non-breaking spaces are never
eliminated.
<p>a b</p>
Ans: 4 spaces. - Write an inline style to indent the first line of a
paragraph by 1 centimeter.
Ans: Use
text-indent: 1cm;
where 1cm is the distance to indent.
Units for Measuring Computer Information
- A bit is a single binary digit (0 or 1).
- A byte is 8 bits.
- A kilobyte (one K) is 210
= 1,024 bytes.
- A megabyte (one Meg) is 220
= 1,048,576 bytes.
- A gigabyte (one Gig) is 230
= 1,073,741,824 bytes.
- A terabyte is 240
= 1,099,511,647,776 bytes.
Images
- Use the following tag to place the image myimage.jpg
on your webpage:
-
<img src="myimage.jpg" />
- An img tag is a combination start/end tag.
Hyperlinks
- A hyperlink is text on a webpage that, when clicked,
causes the browser to display a different page or image.
- Add this tag to display a hyperlink on your page:
<p><a href="http://www.disney.com" target="new">< /br> I want to go to Disneyland</a></p>
The hyperlink text is "I want to go to Disneyland."
You change the href address and hyperlink text to show your favorite website.
- In the hyperlink tag, a means anchor, href means hyperlink reference and target="new" means open the page in a new browser window.
The Nonbreaking Space Symbol
- The ampersand (&) denotes
a special symbol (character entity) in HTML/XHMTL.
- The nonbreaking space (HTML special symbol:
)
denotes a space that cannot be eliminated by a browser or broken
across lines of text.
- Repeated ordinary spaces between words are reduced to one
space by the browser.
- Use if you want more than
one space between two words.
- Other important HTML special symbols:
-
< (<)
> (>)
& (&)
" (")
© (©)
More About Headers and Paragraphs
- Recall that headers are delimited by the tags
<hn> and
</hn>, where n is one of the numbers
1, 2, 3, 4, 5, 6.
- Recall that paragraphs are delimited by the tags
<p> and
</p>.
- Use the
text-align
property to left align, right align, center, or justify
an element. The corresponding values are
left,
right,
center and
justify
- Justified text is usually not recommended for web pages.
- Recall the body of a document is delimited by the tags <body> and </body>.
- To change the foreground color and the background color of a single paragraph, we can
use an inline style attribute:
<p style="color:green; background-color:yellow">
Lists
- Use the tags
<ul> and
</ul>
for an unordered list.
- Use the tags
<ol> and
</ol>
for an ordered list.
- Use the tags
<li> and
</li> for the items in
an ordered or unordered list.
- Use these CSS styles for controlling the numbering of lists:
style="list-style-type:disc"
style="list-style-type:circle"
style="list-style-type:numeric"
style="list-style-type:upper-alpha"
style="list-style-type:lower-alpha"
- Homework 2 description.
Posted: 4-12-2011