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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE6 ignores my simple CSS styles?

Status
Not open for further replies.

Jakobud

Technical User
Mar 9, 2001
51
0
0
US
Take a look at this test page here:


Mozilla of course shows the text in red and at 8 pt. like the style tells it to be, but in IE6 it completely ignores the style. What am I doing wrong? How do I make styles that are the most cross-browser compatible?

Thanks!

Jake
 
Maybe IE doesn't like you inventing up your own <text> tag, maybe it's waiting for a <body> tag. Frankly, I'm surprised that Mozilla likes it, as it's usually more fussy than IE about dubious markup.

If you want to apply styles to particular blocks of text, use a class instead, like this (changes in bold):
Code:
<html>
<head>
	<title>
		CSS Test page
	</title>

<style type="text/css">
	[b].[/b]text
	{
		color: red;
		font-family: arial;
		text-decoration: none;
		font-size: 8pt;
	}
</style>
</head>
[b]<body>[/b]
<[b]p class="text"[/b]>
	This text should be RED, isn't it?
</[b]p[/b]>
[b]</body>[/b]
</html>
If you want to apply a style to all text on a page, apply it to the <body> tag.

-- Chris Hunt
 
Oh okay thanks. I thought that the point of CSS was that you could make up your own tag and their styles... I will try your suggestion. Thank you
 
No, CSS lets you separate page style from page content. It allows you to control the appearance of page elements.
It most certainly does not let you make up your own tags!
 
I believe the original example takes advantage of a CSS2 feature for XML. IE does not support CSS2 well. The code worked in Mozilla and Opera 7 - two browsers with more advanced CSS2 support.

There is some interesting information at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top