I am trying to have three columns of text inside the DIV main-content. I added a class named "3col" with the properties of float: left; width: 200px; but it doesn't work. Any ideas why?
Simple. CSS identfiers( classes or IDs) may NOT begin with numbers. change your class name to "cols_3" and you will see it work, for example. Hope that helps.
Sorry to butt in, but any idea why that is dresden? It's not just CSS either, it seems to be in other scripting languages as well. I wanted to reference my 3D maze by "3d" but came up with so many errors that I changed it to "threed"
Why does a string not work if it starts with an int but will if it contains one? Is there a reason?
HTML5 allows ids to start with an integer although in css you would need to escape them to make it work.
As a matter of interest presently classnames in html can begin with a digit and you can do something like this which is valid html and cssa and works back to IE6.
<!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=utf-8">
More info on escaping css.
Wow, thanks Paul
I did have a think why. I suppose it's quicker to interpret and throw an error rather than check the following characters to make sure it's either an int or string.
This topic is now closed. New replies are no longer allowed.