[thelist] Can't get CSS to work

Joe Crawford jcrawford at avencom.com
Thu Apr 12 19:31:10 CDT 2001


Chris Evans wrote:
> So I finally am working on a project where it is acceptable to have the site
> look like crap in 3.x browsers, as long as it looks decent in 4+ browsers.
> We are also distributing the application, and want our clients to be able to
> easily modify the look and feel.  Sounds like a swell use for CSS!

Well, no reason it has to look like *crap*. Best practice, it would
still be usable in a skeletal way. But I hear you.

> But I can't get it to work for simple things across browsers.  My initial
> testing is in NS 4.7, NS 6.1, and IE 5.0 on Win 2k.  This is more first
> attempt at doing all the look and feel in CSS, and I am failing miserably.
> I use "text-align:center" in one class applied to a TD, and it left aligns
> my table in NS4.7. 

You may have the syntax wrong, or a style on the TD that conflicts --
this works for Netscape 4.7x fine...

<style type="text/css">
<!--
.sex {
	text-align: center;
	background-color: #EEE;
	color: #F00;
	}
/* apologies for that classname, what am I thinking about? Zoinks! */
//-->
</style>
<table width=500>
 <tr>
  <td class="sex">hello sailor!</td>
 </tr>
</table>


> I can't get a class to overwrite my default link styles
> teh same way in all three browsers.

Hrm. given *this* problem I'd bet you have errors in your CSS. Time to
validate your CSS:

Pop your whole stylesheet in here:
http://jigsaw.w3.org/css-validator/validator-text.html

And see what pops out. Compared with HTML, CSS is *intensely* sensitive
about syntax.

> I am trying to avoid using my old stand-bys like FONT tags in A tags to
> overwrite the fonts, and align attributes in my tables.  I'm trying to do
> too much, or is it my ignorance of CSS, do you think?  How much old-school
> stylin' do I still have to use to get things to work cross-browser?

You'll be fine, the validators (css and html) are your friend, better
code has great rewards, and is really what it takes to do it right.

HTH,
	Joe <http://artlung.com/>
--
Joe Crawford ||||||||||||||       mailto:jcrawford at avencom.com
||||||||||||||||||||||||             http://www.avencom.com
|||||||||||||||||||||||||||      Avencom: Set Your Sites Higher




More information about the thelist mailing list