Forum Moderators: open

Message Too Old, No Replies

question on how to nest tags properly

         

amythepoet

7:26 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

Here is my question. If I am bolding a few words on a page, but I would like those bolded words to be a link to another page, do I write it like this:

<a href="joeschmo.html"><b>joe schmo</b></a>?

Thanks

iamlost

8:19 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There are two approaches:

* One: Your example is the correct HTML nested tag approach. The tag opened last is closed first, the tag opened first is closed last and <b></b> definitely bolds the font.

* Two: The alternative is to use CSS.
For example:

CSS:

a {font-weight: bold;}

HTML:
<a href="joeschmo.html">joe schmo</a>

will give the same result.

Note: If only some <a>text</a> is to be displayed bold invoke one or more classes.
For example:
CSS:

a.boldtext {font-weight: bold;}
a.redtext {color: red;}

HTML:
<!-- anchor text is the same as surrounding text -->
<a href="joeschmo.html">joe schmo</a>

<!-- anchor text is bold -->
<a class="boldtext" href="joeschmo.html">joe schmo</a>

<!-- anchor text is red -->
<a class="redtext" href="joeschmo.html">joe schmo</a>

<!-- anchor text is both bold and red-->
<a class="boldtext redtext" href="joeschmo.html">joe schmo</a>

[edited by: tedster at 1:12 am (utc) on Jan. 24, 2005]
[edit reason] fix typos in the HTML [/edit]

amythepoet

8:45 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks very much, I appreciate it.