...

View Full Version : class applays beyond a tag ?



BubikolRamios
12-24-2009, 02:34 PM
If you run this you will see one fantom underlined space character after 'codingforums', it appears if only one   is added. Tested in
FF. What is that ?



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
.l
{
text-decoration:underline;
}
</style>
</head>
<body>
<a class ="l" href ="#">
codingforums
</a>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;

</body>
</html>

VIPStephan
12-24-2009, 02:47 PM
Line breaks are sometimes treated as text nodes in some browsers. This also leads to problems with JavaScript sometimes since different browsers handle it differently.

So, there’s a difference if you write:

<a class ="l" href ="#">
codingforums
</a>

or

<a class ="l" href ="#">
codingforums</a>


Likewise there’s a visual difference if you write:


<ul>
<li></li>
<li></li>
<li></li>
</ul>

and make li {display: inline;} rather than li {float: left;}

And also there’s a difference if you write:


<img src="…" alt="" />
<img src="…" alt="" />
<img src="…" alt="" />

or

<img src="…" alt="" /><img src="…" alt="" /><img src="…" alt="" />


The trick here is that the ending tag and the starting tag of the next element must be on the same line. So you could also write:


<img src="…" alt="" /><img
src="…" alt="" /><img
src="…" alt="" /><img
src="…" alt="" />


And by the way: Class names must not start with a number. They have to start with a regular letter of the latin alphabet.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum