The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> CSS advantage over deprecated in-line tags ?
Holmwood
post Dec 5 2023, 03:32 PM
Post #1





Group: Members
Posts: 1
Joined: 5-December 23
Member No.: 29,095



First post here and just a general point as much as a query. I have a couple of small hobby websites and have not used CSS, but have been looking into it. Not sure I really see the point except that O'Reilly's HTML The Definitive Guide warns that numerous simple old-style tags are likely to be discontinued some time soon (and my edition is 20 years old*), like u for underline and even font.

I can see the point of CSS for Megacorps websites where they want a common corporate style and provide a common .css file for everyone to use. That's fine, but is there a good reason to deprecate and maybe discontinue the older simpler method? The Guide has an undertone that they wish deliberately to make it more tiresome to change font and colour etc, to discourage people from making their websites look like ransom notes. But is that a big problem these days?

For example I want to make a single character in a text a different colour. Every example I found on the web of using CSS to change colour involved an entire block of text that already had some tag, such as a paragraph, division, heading, or the whole document. I did eventually discover the SPAN tag, so in my application I could do either with the old deprecated font tag :-

CODE

<BODY>
The dial has black numbers for the shutter speeds, but the flash sync speed is shown with a red <font color=red>X</font>, which is 1/60th of a second.
[etc etc]
</BODY>

Or I could use the significantly longer CSS approach, first defining the style attribute in the document head :-

CODE

<HEAD>
<style type="text/css">
<!--
SPAN.redfont {color: red}
-->
</style>
[etc etc]
</HEAD>

<BODY>
The dial has black numbers for the shutter speeds, but the flash sync speed is shown with a red <span class=redfont>X</span>, which is 1/60th of a second.
[etc etc]
</BODY>

I have abbreviated this code of course.
Am I missing something?

* 3rd edition, not the latest.

This post has been edited by Holmwood: Dec 5 2023, 03:36 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
pandy
post Dec 6 2023, 02:50 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,737
Joined: 9-August 06
Member No.: 6



QUOTE(Holmwood @ Dec 5 2023, 09:32 PM) *

O'Reilly's HTML The Definitive Guide warns that numerous simple old-style tags are likely to be discontinued some time soon (and my edition is 20 years old*), like u for underline and even font.


That has already happened. FONT was among the first to go, and rightly so. It was already deprecated 20 years ago when you bought that book. That doesn't mean they don't work. IIRC B was never deprecated though.

As Christian says, CSS is really simpler. Your example of coloring a single letter is an exception from the rule. Think instead of the normal case. You have a page with a lot of paragraphs.

With only HTML you need to do this.
CODE

<p>
<font face="Arial" size="3">Blah blah blah...</font></p>
<p>
<font face="Arial" size="3">Blah blah blah...</font></p>
<p>
<font face="Arial" size="3">Blah blah blah...</font></p>
<p>
<font face="Arial" size="3">Blah blah blah...</font></p>
...


And if you want to change anything you need to edit all those font tags on all pages.

With CSS you only have this.
CODE
<p>
Blah blah blah...</p>
<p>
Blah blah blah...</p>
<p>
Blah blah blah...</p>
<p>
Blah blah blah...</p>
...


And a single line of CSS that is easy to change.
CODE
p   { font: 100% Arial, sans-serif }


If it's worth it to you to rework your sites, I don't know. If you are still working with them, adding new content and so on, I'd say yes, go for it. If you just keep them up but don't do much with them, maybe not. Unless you see it as an opportunity to learn.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 13th June 2024 - 07:56 PM