Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maddening CSS issue

Status
Not open for further replies.

GiffordS

Programmer
May 31, 2001
194
0
0
CA
Ok, let me begin by saying that I am a programmer and not a designer. I know as little as I possibly can about design. I can't even draw stick people! Anyway, the issue is a simple one, I'm sure. I have a piece of CSS that I use and re-use all of the time that works perfectly for me. However, I am using it on a new page and it doesn't work! The CSS is simple...

<style>
a:link{text-decoration:none;}
a:visited{text-decoration:none;}
a:hover{text-decoration:none;}
a:active{text-decoration:none;}
</style>

I use it so that I can declare the font color of text links in the running html, rather than have them all default to that awful link blue. Now I have put it on a new page and lo and behold... the links are all link blue! And no, that's not the font color I declared in the <font> tag. I am using this exact code on other pages on the same site... same server, same browser.... I literally copied and pasted.... they are exactly the same and it works beautifully elsewhere. I'm really at a loss here. I can't imagine a problem w/ the CSS because, as I said, it has always worked for me. Does anyone know of anything that I could have done further down in the body of the document that might cause this to stop working? It really is driving me nuts.

 
Firstly you shouldn't be using <Font> tags, they are old..very very old. All your styles should be defined in your CSS.

Are you using any more CSS? Can you paste it?
Also do you have anything defined in the <body> tag?


<!--#sig value=''É'' url='' -->
 
Oddly enough, the problem leapt right out at me as soon as I posted this. I was using the <a href> tag inside of the <font> tag, rather than the other way around. I switched them and it worked perfectly. I know I should probably pick up the CSS and get rid of the old <font> tags, but like I said, I'm not really a designer. I'm sort of like the punter on a football team that doubles as an emergency quarterback. I'll stick to my php and java and leave the design, css, and html to you guys. Thanks so much for the fast response, though. I really do appreciate it.
 
Just don't use <font> tags anymore ;-)

You are using CSS for something, why not set up the font style with CSS too.

Then if you need to change the font or style of your links etc, you just have to change 1 bit rather than lots of <font> tags.

It will also make your code lighter, more readable and make us CSS folks feel all warm inside.

As a programmer I am sure you can see the benefit of coding more efficiently.
 
You could simplify things as well as cut down on code by simply declaring your font color in style sheet and deleting the <font> tags for your links
Code:
<style type="text/css">
a:link{text-decoration:none; [b][COLOR=red]color: red [/color][/b]or whatevercolor}
a:visited{text-decoration:none;  color: red }
a:hover{text-decoration:none;  color: red }
a:active{text-decoration:none;  color: red }
</style>

This would provide the color information for all your links.
 
I disagree 100% about not using <font> tags anymore. I've been a developer/markerter in Web Design for the past 8 years and I always use them. I refrain from CSS if I have to for browser compatibility issues and because I feel it's pretty useless and a great page can be created without it.

<font> tags are here to stay, like it or not. I encourage people to continue using them rather than merging into CSS.
 
I have to respectfully disagree with cgimonk. Sure, using font tags works and there are cases where font tags are more suitable but it's the most inefficient method of formatting text, not to mention that you're limiting yourself to just 7 font sizes. Additionally, your pages are infinately more difficult to change, mouseover text effects require unnecessary javascript coding (making for larger file sizes and slower loading speeds), and all of this makes your fees unnecessarily high and it takes you way to long to create pages.

As far as browser compatibility goes, I've been using CSS for 5 years and I've never encountered a situation yet where I've not been able to use a CSS solution because of the browser. No, I don't try to support old browsers that don't support CSS - it's not feasible and is an injustice to my clients to try to do so.

Just my two centavos....

There's always a better way. The fun is trying to find it!
 
Netscape in itself is very poor at supporting CSS stylesheets. Go into most message boards on CSS or read books teaching CSS and you'll see this little factoid. That in itself makes me really sway away from it as much as I can.

Only limited to 7 font sizes? Is that a limit or should that be a standard? There is absolutely no reason your font should require a size that doesn't fit these. For years websites..professional ones, were build with these "limitations".

I hard code every page I ever made, even my Perl/CGI and PHP scripts and don't find a real use for CSS. Only thing I use are SSIs to keep the layout, but as for text and items like this, every page can be different so you may as well use raw HTML.

I respect your opinion, but in my experience I prefer and will continue using HTML soley.
 
>> "Netscape in itself is very poor at supporting CSS stylesheets"
yeah, maybe 4.5 was, but modern NS6+ excels at CSS beyond IE. take a look at Moz Firefox when you get a sec to see what a real browser is.

>> " Go into most message boards on CSS or read books teaching CSS and you'll see this little factoid."
you've got to get a book newer than 1997, brother

and the <font> tag is deprecated...you don't continue to use deprecated Java methods do you?

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 

>> I know I should probably pick up the CSS and get rid of the old <font> tags, but like I said, I'm not really a designer.

Nope - but you do label yourself as a programmer... And as a programmer, I'd have thought this would be the first thing you'd want to do - update your code to be in keeping with the correct standards, and not using old, deprecated tags.

Designers don't care about CSS... as long as their design is implemented and looks how they intended it to look, they usually don't care how it's done. Programmers, however, do and should care about CSS because it's code-based. It affects how easily their code, etc can be updated to keep in line with changes given to them by the designers.

Just my views as a developer who has worked with many designers over the last 6 years ;o)

Dan
 
cgimonk Though I too respect your opinion, it does concern me that someone with your experience feels it better to "stick in the mud" than embrace the powerful tool that CSS is. By separating content from styling you will make life easier for yourself.

Yes, a decent page can be made using <font> tags etc. But it is also possible to make a decent page that uses CSS instead. What is more the CSS page will be smaller and easier to edit in future. In addition, if your HTML is generated by a PHP script, it makes your PHP lighter too, reducing server load.

Do you ever need to update a client's site with a new look? New colours? New layout?
Do you have to go back to scratch and rebuild all the pages?
Use CSS and it's simply a matter of changing the CSS rules and you have a new look site using the original content.

Using CSS and conforming to web standards not only makes your life easier, it also means that you deliver better product to your clients. Websites that are lighter on bandwidth, degrade gracefully and will be compatible with future browsers/devices.

Using CSS also means that you can provide alternate stylesheets for different sets of users/situations.
For instance, a stylesheet that uses more contrasting colours and larger text for the visually impaired. Or even just a different stylesheet that is used when the user wants to print a page.

From recent experience I have had to take over a number of sites coded by someone else using <font> tags all over the place. They are difficult and time consuming to manage. One of the complaints of the original author was that there was never enough time to do all the updates etc that the clients demanded.
I have converted a number of these pages to use CSS and they now not only work better (load faster etc) but are much easier to edit. Even the client can look at the source code and not be put off since all he really sees is his content surrounded by basic HTML tags. All the styling is done by the CSS stylesheet. The client is now much more confident in my company and the work we do for him.

I feel perhaps your interpretation of what CSS is may be jaded by bad experiences brought on from V4 and earlier browsers. Take another look at what CSS can do, and how it can help your productivity and creativity. By dismissing it you are selling yourself, your work and your clients short.
 
For years websites..professional ones, were build with these "limitations".[/q]

For years, we got along very well WITHOUT computers!

Again, I respect your decision not to use CSS. But as has been pointed out by other threads, CSS is to web page development as understanding DNA is to the health sciences. It's a new method to doing old things. Yes, old browsers couldn't handle CSS and there are still some quirks across browsers but if you can read the hand writing on the wall, it won't be long until a large number of html tags won't be supported by any new browser.

There's always a better way. The fun is trying to find it!
 
I can't even remember how to use the <font> tag, that's how long ago I gave up using them, and I am surprised anyone would still want to use them. It just doesn't make sense.


<!--#sig value=''É'' url='' -->
 
Agreed, CSS and XML are here to stay. Deprecated tags should never be used, and if I was a customer; I'd stay from anyone who continues to use Tables (for layout) and font tags.

What can be done in 5 lines of text can reduce the 300 calls for a specific tag, making your coding streamlined, efficient and less resource intensive.
 

There's a whole world of difference between using FONT tags and using TABLE tags, I think. Font tags are useless to all but the older browsers. Table tags, however, have not yet (IMHO) been completely replaced by CSS, as there are still some things that you cannot do properly with CSS.

Dan
 
I have to agree with everyone who embrases CSS (especially for replacing the font tags). I was once stuck with the opinion that 'if it ain't broke, don't fix it' and was reluctant to move to CSS, but as soon as I spent a bit of time learning the new methods I never looked back.

In regards to replacing the font tags; go for it. It's so simple to implement and I've not found any problems with current browsers. I agree with Dan that replacing the tables is a bit more involved, but even that has worked for me. I now use CSS for all new web pages without any issues and find it saves me a lot of time when combining it with ASP.NET for dynamic pages. I've saved possibly hundreds of lines of VB code just by using CSS for layout.

As a programmer GiffordS I suggest you update your skillset and embrase CSS. As Dan said it's a programmers responsibility to keep up with the newest standards in coding. Although I respect your opinion cgimonk I would suggest looking into using CSS and even try making a few small sample pages. I would hope you'll see the benefits once you try it.

Anyway I'll stop babbling now! Back to work.

Steve Gordon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top