Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts

    class applays beyond a tag ?

    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 ?

    Code:
    <!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>

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    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:
    Code:
    <a class ="l" href ="#">
        codingforums
        </a>
    or
    Code:
    <a class ="l" href ="#">
        codingforums</a>
    Likewise there’s a visual difference if you write:
    Code:
    <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:
    Code:
    <img src="…" alt="" />
    <img src="…" alt="" />
    <img src="…" alt="" />
    or
    Code:
    <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:
    Code:
    <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.

  • Users who have thanked VIPStephan for this post:

    BubikolRamios (12-24-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •