1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Problem with HTML/CSS "code"

Discussion in 'Software Development' started by mcseguy9, Jan 28, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. mcseguy9

    mcseguy9 Thread Starter

    Joined:
    Jun 11, 2001
    Messages:
    387
    **I just noticed that it won't display the code as is so I've removed most of the <>. I hope this makes sense.**

    I'm taking a class and it involves a tiny little bit of HTML and CSS "programming". Anyway, what you see below is straight from the book and it's not working!!! It's very irritating. I have the wallpaper.gif file in the same folder as the HTML file (it's name is bg-test2.html). I double click on the HTML file and I get 2 white cells with text in them. The cell on the right is supposed to have the wallpaper.gif image tiled horizontally. Any ideas what's not letting this work? I've gone over it half a dozen times and can't figure it out. Thanks for your help.

    html
    head
    style TYPE="text\css"
    <!-
    .bg2 {
    background-image: url(wallpaper.gif);
    background-repeat: repeat-x
    }
    //->
    /style
    /head
    body
    table HEIGHT="100%" WIDTH="100%" BORDER="1"
    tr
    td WIDTH="200" BGCOLOR="#FFFFFF"
    some text
    /td
    td WIDTH="250" CLASS="bg2"
    some more text
    /td
    /tr
    /table
    /body
    /html
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Please post the code for the HTML as well as the CSS. Can't tell much from just the table there.
     
  3. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    I couldn't get it working by defining a css class so I just used a style attribute.

    PHP:
    <html
    <
    head
    <
    style type="text/css">
    </
    style
    </
    head
    <
    body>
    <
    table height="100%" width="100%" border="1">
    <
    tr
    <
    td width="200" bgcolor="#ffffff">some text</td
    <
    td width="250" style="background-image:url(http://home.tbbs.net/shadow/mod_files/stars.jpg);
    background-repeat:no-x"
    ><font color="#ffffff">some more text</font></td
    </
    tr
    </
    table
    </
    body
    </
    html>
    I put in a working url so you can see that it works.

    Just put wallpaper.gif back in for the url.

    Just keep in mind that the above method might not work in opera 7b2. Of course it still works in the stable opera 6.05. I also tested it will all other browsers. It should work.

    as for defining a css class,

    it seems like the background image url part of a td css class doesn't affect the table cell.

    but if you want to try it you should use the following example for defining a td class

    PHP:
    <style type="text/css">
    td.bg2 {then your settings};
    </
    style>
    I tried that though and could not get it to work for a background image. However defining fonts etc for the td worked fine. Just the background image wouldn't work.
     
  4. bassetman

    bassetman Moderator (deceased) - Gone but never forgotten

    Joined:
    Jun 7, 2001
    Messages:
    47,973
    I think Shadow2531 found an important item.
    May want to check www.htmlgoodies.com for more background if you need support info for your class.
     
  5. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    opera 7.0 final is out.

    I tested the style attribute from above with opera 7.0 and it works. so it should work well in all the browsers.
     
  6. mcseguy9

    mcseguy9 Thread Starter

    Joined:
    Jun 11, 2001
    Messages:
    387
    Thanks a million, guys. I appreciate the help.
     
  7. Shadow2531

    Shadow2531

    Joined:
    Apr 30, 2001
    Messages:
    2,636
    ok I figured it out the right way.

    PHP:
    <html
    <
    head
    <
    style type="text/css"
    td {background-image:url(http://home.tbbs.net/shadow/mod_files/stars.jpg); 
    background-repeat:no-x;}
    td.off {background-imagenone; }
    </
    style
    </
    head
    <
    body
    <
    table height="100%" width="100%" border="1"
    <
    tr
    <
    td class="off" width="200" bgcolor="#ffffff" >some text</td
    <
    td width="250" ><font color="#ffffff">some more text</font></td
    </
    tr
    </
    table
    </
    body
    </
    html>
    the above way defines a background image for every td. then you use the td class off to turn off the background of a td that you don't want to have a background.

    Obviously you could choose not define the standard td and then just define td.on and for each cell that you want to have a background, you would use class = " on " like this

    PHP:
    <html
    <
    head
    <
    style type="text/css"
    td.on {background-image:url(http://home.tbbs.net/shadow/mod_files/stars.jpg); 
    background-repeat:no-x;}
    </
    style
    </
    head
    <
    body
    <
    table height="100%" width="100%" border="1"
    <
    tr
    <
    td width="200" bgcolor="#ffffff" >some text</td
    <
    td width="250" class="on" ><font color="#ffffff">some more text</font></td
    </
    tr
    </
    table
    </
    body
    </
    html>
    not sure why I couldn't get it to work before, but that works
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Problem HTML code
  1. n00e
    Replies:
    2
    Views:
    117
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/115750

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice