border-style: solid;
to <a> and <p> elements to be able to o bserve the position of the borders of ele ments.
By the way, there’s a very handy tool for observing element borders already integrated
inside Google Chrome. It is very useful and I will demonstrate how to use it in our
next meeting.
Actually, without changing the HTML code that I gave you, there’s no way yo u could
right align the link without right aligning the two paragraphs as well. Although you
can try the following stunt:
a {
display: block;
text-align: right;
}
One of the problems with that is tha t now every <a> element becomes a block ele-
ment. It’s true that there aren’t any other <a> elements in our example , but you should
generally avoid solutions like that.
Maria: If it’s working, why?
Professor: It is consid ered a bad style to change something as basic as is the ele-
ment’s display on well-defined HTML elements in order to get some results that can
be ach ieved more elegantly by other means.
Mike: A nother reason is that block elements are not permitted inside p aragraph s, ar e
they?
Professor: Right, block elements. <a> is not a block eleme nt even if you change its
display. Remember that the block-inline HTML categorization refers to the default
display value of an element. If you change it using CSS, that doesn’t change the
element’s categorizatio n as viewed by HT ML. Yet you don’t usually want to change
an eleme nt’s display if you have other options.
Mike: I see. And what would be the r ight solution then?
Professor: You can solve the problem by using the right selector. Today, you will
learn how to use different selectors, which is one of the most impor ta nt skills for
efficient CSS coding.
Before we continue, I would like to ask yo u one la st thing about your homework.
I’ve noticed tha t you’ve defined font sizes for the headings and footer but you didn’t
specify the font size for the article. Was that on purpose?
Mike: Yes, we wanted to use the default font size fo r the ordinary text. You said the
other day it was 16 px, d idn’t you?
Professor: If you use pixels for fo nt sizes, it is not a good idea to rely on default sizes.
That is yet another topic that awaits us today.
4.1. Homework Discussion 53