#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    43
    Rep Power
    12

    Link problem in css


    hi all,

    I have a link problem in css, i have 3 files in the same directory, file1.html, file2.html, style.css

    file1 and file2 are the same except the <style> part, file1 links to style.css but file2 hard code the style between <head> tag.

    file1.html:
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="style.css" />
    </head>

    <body>
    <b>Test CSS</b>
    <form>
    <table>
    <tr>
    <td align="right"><b>User Name:</b></td>
    <td><input type="text" name="LoginName" /><td>
    </tr>
    <tr>
    <td align="right"><b>Password:</b></td>
    <td><input type="password" name="LoginPW" /><td>
    </tr>
    </table>
    <input type="submit" value="Login" />
    <input type="reset" value="Reset" />
    </form>
    </body>
    </html>

    file2.html:
    <html>
    <head>
    <style type="text/css">
    body { background-color: #333333; color: orange; font-family: Verdana; font-size:18px;}
    table { color: orange; font-family: Verdana; font-size:14px}
    form { color: orange; font-family: Verdana; font-size:14px}
    input { font-family: Verdana; font-size:14px}
    </style>
    </head>

    <body>
    <b>Test CSS</b>
    <form>
    <table>
    <tr>
    <td align="right"><b>User Name:</b></td>
    <td><input type="text" name="LoginName" /><td>
    </tr>
    <tr>
    <td align="right"><b>Password:</b></td>
    <td><input type="password" name="LoginPW" /><td>
    </tr>
    </table>
    <input type="submit" value="Login" />
    <input type="reset" value="Reset" />
    </form>
    </body>
    </html>

    style.css:
    <style type="text/css">
    body { background-color: #333333; color: orange; font-family: Verdana; font-size:18px;}
    table { color: orange; font-family: Verdana; font-size:14px}
    form { color: orange; font-family: Verdana; font-size:14px}
    input { font-family: Verdana; font-size:14px}
    </style>

    However, the output is different. file2.html (hard code css) shows the result I predict. file1.html (link one) cannot change the background colour to #333333 and the text color of <b>Test CSS</b> is not orange.

    Can anyone tell me why this happens? Thanks a lot.

    ypc
  2. #2
  3. mod_dev_shed
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2002
    Location
    Atlanta, GA
    Posts
    14,817
    Rep Power
    1099
    Try removing the <style> tags from style.css.
    # Jeremy

    Explain your problem instead of asking how to do what you decided was the solution.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    43
    Rep Power
    12
    it works now, thanks a lot

    ypc

IMN logo majestic logo threadwatch logo seochat tools logo