Click to See Complete Forum and Search --> : text format question
firegryphon3207
05-27-2003, 01:14 AM
I'm not exactly new to CSS. In fact, I love CSS and I use it where I can. But recently I came across something interesting. And I'm not sure how to handle this one.
say I have a sentance, and for some reason, need just one word underlined or in bold. If the latest standards say I shouldn't use <b></b> or <u> </u> tags, then how would I convert something like...
I <b><u>LOVE< /u></b> CSS ?
argon
05-27-2003, 05:18 AM
.unnamed {
font-weight: bold;
text-decoration: underline;
}
HTML:
I <span class="unnamed">LOVE</span> CSS!
:) Good Luck!
Argon
Charles
05-27-2003, 06:09 AM
Your page needs to make sense without style sheets or presentaton mark up. (http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-order-style-sheets) If you are trying to indicate emphasis then use the EM element.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>
<style type="text/css">
<!--
em {font-style:normal; font-weight:bold; text-decoration:underline; text-transform:uppercase}
-->
</style>
<p>I <em>love</em> <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
Nevermore
05-27-2003, 07:30 AM
Just as a question; I understand that both the <strong> and <em> elements have been left in the HTML4.01 specification, although they seem to accomplish the same task. Is this just to give you more control over presentation, or is their another reason that you know of?
Charles
05-27-2003, 07:35 AM
Originally posted by cijori
Is this just to give you more control over presentation, or is their another reason that you know of? HTML should never be used to control presentation but to describe the meaning of the content. EM means emphasis and STRONG means strong emphasis. See http://www.w3.org/TR/html4/struct/text.html#h-9.2.1.
Nevermore
05-27-2003, 07:42 AM
Originally posted by Charles
HTML should never be used to control presentation but to describe the meaning of the content.
You misunderstand - I meant only that you could set seperate style sheet rules for the two of them. Thankyou for explaining their different meanings though.
nkaisare
05-27-2003, 10:10 AM
Originally posted by cijori
You misunderstand - I meant only that you could set seperate style sheet rules for the two of them.
If you do not use CSS, <b> and <strong> will display same for a visual browser. However, the former just styles the text visually (and has no meaning semantically), while the latter implies strong emphasis (which HAS a semantic meaning).
Hence to make text bold, you should use <span style="font-weight: bold"> instead of <b>. However, to state the phrase empatically, you should use <strong>. You may choose to (visually) style <strong> anywhichway you prefer.
Nevermore
05-27-2003, 11:20 AM
ummm... noone was talking about using <b>. I was refering to <em> and <strong>.
nkaisare
05-27-2003, 11:25 AM
ummm... noone was talking about using <b>. I was refering to <em> and <strong>.
You may choose to (visually) style <strong> anywhichway you prefer.
:)
- Niket
firegryphon3207
05-27-2003, 11:42 AM
thanks for the replies.
So here's another question, which would be more appropriate to use?
<em style=text-decoration:underline;"></em>
or
<span style="text-decoration:underline;"></span>?
and just for the sake of arguement, what is the meaning of the span tag? Is it just me as it seems like the <div> tag, lots of people use it, but only hard core coders can tell you what it means and use it correctly.
As an aside, style can never make up for poor writing.
Nevermore
05-27-2003, 11:46 AM
Depends what you are doing. If you are trying to emphasise some text, em is better. If you are just doing 'cosmetic surgery' then span.
Div and span are for grouping features together. The only difference between them is that div is block level (square shaped, adds line breaks afterward), while span is inline (hugs the exact shape and size of it's contents.)
firegryphon3207
05-27-2003, 12:11 PM
Thanks. Now if I could only figure out why frontpage creates such bloated documents :D
nkaisare
05-27-2003, 01:51 PM
Now if I could only figure out why frontpage creates such bloated documents :D
Because its evil :)
hastx
05-27-2003, 03:17 PM
Originally posted by firegryphon3207
Thanks. Now if I could only figure out why frontpage creates such bloated documents :D
You should see what dreamweaver did in the hands of the less experienced users i've seen. :eek:
firegryphon3207
05-27-2003, 03:20 PM
I dread to think, I use dreamweaver MX for coding, but I've never actually done anyting in any other views using dreamweaver. But I have had more than my share of "fixing" sites that were started by small business owners who used front page because it came with their office software! :D