Jim S said:
My use of the <br> tag has been criticised in favour of <p></p> paragraph
tags.
Since the latter involves 'before and after' line formatting, it seems to
be taking a sledgehammer to crack a nut.
I'm sure there must be a reason, but I can't see it.
Explain please.
Short answer:
You need to specify the exact case of the criticism. In some
circumstances it would be using a sledgehammer to crack a pea, in others
not.
Longer answer:
From my recollection of your pages, there are many pictures and
thumbnails, captions and explanations of pics... So I will address just
these two cases. One where there is a thumbnail or bigger and a caption.
Two, where there is a pic and some longer explanation or reference to
the picture.
One, it is quite acceptable to use a br if you are using an inline image
to place a few short words underneath the pic. If you do nothing, then
the words will generally appear to the right and wrap only when space
runs out - not what is wanted! You want a line break and that is what br
does. It also has the natural advantage of making the words nice and
close to the bottom of the pic, assuming line-height is not unusual. A
look that is often wanted.
But talking about looks, one advantage of enclosing the text, even in
this particular circumstance in a suitable suitable element is that this
element can often be more easily styled. The style can be changed in a
style sheet to affect the whole site. You can have the text bold, or
italic or small or big. You can also have the top margin smaller than
the usual default (Browsers give p elements, for example, default
margins that satisfy the usual needs of authors. Sometimes the author
wants to use a paragraph without the usual gaps and in CSS this is
easily accomplished).
I am still on "one", the topic of the shortish caption. Above I
mentioned the alternative to a simple br but did not mention a p
specifically because it would be slightly uncomfortable to use a p for
something that is not in the normal way a paragraph (a set of sentences,
followed or preceded by others usually). In practice, it is not so easy
to be so strict and a p would be acceptable imo. But if you wanted to be
a bit stricter, you could use a div or even a span (depending on what
quite you wanted).
None of this stuff is laid down in heaven, you have to make decisions,
how semantically strict you want to be, how such semanticity would be
appreciated or totally wasted on the world and so on... <g>
But the main point remains, you can just use br here for a caption.
You can also style the words in spite of the br and no separate element
for the words. (No, I am not contradicting what I said above) by
attention to your circumstances. For example if your captions are in a
context like:
<div class="thumbbox>
<img src="dummy.gif" alt="some">
<br>
a shortish caption
</div>
You can style
..thumbox img {display: block;}
and this will stop the image being inline. The text will then
automatically go to the next line.
You can also style the text by the handle of the class:
..divbox {font-size: .9em; font-weight: bold; width:
....thumbnail-size...;}
if there is no other text associated with such divs.
Now to the second case where you have a picture and you truly want to
say a few words, it is not a mere caption. Well, a paragraph looks to me
to be the appropriate thing to use here. I better stop, had not meant to
go on so with the above. <g>