Results 1 to 11 of 11

Thread: Dreamweaver: Css background

  1. #1
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590

    Dreamweaver: Css background

    If I set it in page properties it tiles on the right side of the screen, so I ant to use it in CSS. The problem with CSS is it doesn't work.

    If I set it in CSS there is only a thin strip of the bg across the top of the page.

    1 guy at macromedia said to check and see if it was in <p> tags. Well, I don't know what the code is suppose to look like to compare and see what I need to do with the tags.

    This is what the code looks like:

    <style type="text/css">
    <!--
    .background {
    background-attachment: fixed;
    background-image: url(../images/background.jpg);
    background-repeat: no-repeat;
    }
    -->
    </style>
    </head>

    <body>
    <p class="background">&nbsp;</p>
    </body>
    </html>

    and when it says that it looks like this:

    http://mywebpages.comcast.net/grimson1/pics/dream.gif



    thanks.

    Crackin' skulls and breaking kneecaps.

  2. #2
    Elite Member TonyT's Avatar
    Join Date
    Jan 2000
    Location
    Fairfax, VA
    Posts
    10,337
    Put something IN the <P>. As it is, it's just an empty <P>. It must have something in it, even if it's a nbsp; .
    No one has any right to force data on you
    and command you to believe it or else.
    If it is not true for you, it isn't true.

    LRH

  3. #3
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590
    Originally posted by TonyT
    Put something IN the <P>. As it is, it's just an empty <P>. It must have something in it, even if it's a nbsp; .

    Looks like this now and still no good:

    <style type="text/css">
    <!--
    .unnamed1 {
    background-image: url(../images/background.jpg);
    }
    -->
    </style>
    </head>

    <body>
    <p class="unnamed1">nbsp;</p>
    </body>
    </html>
    Crackin' skulls and breaking kneecaps.

  4. #4
    Elite Member TonyT's Avatar
    Join Date
    Jan 2000
    Location
    Fairfax, VA
    Posts
    10,337
    DUH! My bad...
    I reread your code from the first post.

    ( "../images/background.jpg");
    No one has any right to force data on you
    and command you to believe it or else.
    If it is not true for you, it isn't true.

    LRH

  5. #5
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590
    <style type="text/css">
    <!--
    .unnamed1 {
    background-attachment: fixed;
    background-image: url(../images/background.jpg);
    background-repeat: no-repeat;
    }
    -->
    </style>
    </head>

    <body class="unnamed1"><body class="background">
    <p>&nbsp;</p> </p>
    </body>
    </html>



    Thats the code that got it too work.


    Now for anew project: defining a site size. What screen resolution do you suggest I set the site as and how to do it. I thought doing it in CSS would control the size of the image to fit any resolution, was I wrong ??


    Thanks for the help Tony.

    Crackin' skulls and breaking kneecaps.

  6. #6
    Elite Member TonyT's Avatar
    Join Date
    Jan 2000
    Location
    Fairfax, VA
    Posts
    10,337
    Now I am confused. Did you want to use css for the body bg or for the bg in a paragraph? The last code above has an undefined class in the body tag:

    <body class="background"> is undefined within the css in the head.

    re resolution:
    With css you can use exact pixel positioning for page content or you can use % that will scale to the browser window. Best bet for images is no bigger than 800x600 and the page will display in 95% of all viewers.

    read up on css here:
    http://www.w3schools.com/css/default.asp
    No one has any right to force data on you
    and command you to believe it or else.
    If it is not true for you, it isn't true.

    LRH

  7. #7
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590
    Originally posted by TonyT
    Now I am confused. Did you want to use css for the body bg or for the bg in a paragraph? The last code above has an undefined class in the body tag:

    <body class="background"> is undefined within the css in the head.

    re resolution:
    With css you can use exact pixel positioning for page content or you can use % that will scale to the browser window. Best bet for images is no bigger than 800x600 and the page will display in 95% of all viewers.

    read up on css here:
    http://www.w3schools.com/css/default.asp
    <body class="unnamed1">

    is that what your talking about undefined ?? It's just unnamed1 at the moment. It shows up as the body background.

    thanks again Tony.
    Crackin' skulls and breaking kneecaps.

  8. #8
    Elite Member TonyT's Avatar
    Join Date
    Jan 2000
    Location
    Fairfax, VA
    Posts
    10,337
    Why not just put ALL the declarations in CSS like so:



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Morehead Design Studios</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    color: #FFFFFF;
    background: #000000;
    background-attachment: fixed;
    background-image: url(images/background.jpg);
    background-repeat: no-repeat;
    background-position: center center;
    }


    a:link {color: #FF9900}
    a:visited {color: #FF3300}
    a:hover {color: #FFFFFF}
    a:active {color: #FFFF00}


    -->
    </style>
    </head>
    <body>
    <table width="88" height="373" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutDefaultTable-->
    <tr>
    <td width="88" height="19" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>
    No one has any right to force data on you
    and command you to believe it or else.
    If it is not true for you, it isn't true.

    LRH

  9. #9
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590
    I was just really shocked and happy I got it to work. I'm still reading on that link you gave me.

    I appreciate your help Tony.

    Crackin' skulls and breaking kneecaps.

  10. #10
    Elite Member TonyT's Avatar
    Join Date
    Jan 2000
    Location
    Fairfax, VA
    Posts
    10,337
    CSS is real easy if you start out using in in simplist form. For instance, you can set ALL properties of page elements (tags and stuff within the tags).

    body (xxxxx: yyyyy]
    p {xxxxx: yyyyy}
    table (xxxxx: yyyyy}
    tr {xxxxx: yyyyy}
    td {xxxxx: yyyyy}

    Anyb time you use a tag that has styles declared in the CSS, the element will inherit those special propwerties, therefore there is less actual coding you have to do overall. For instance, per the above, ALL <P> paragraphs will have the style xxxxx: yyyyy.

    You can set CSS styles for all tags as well as custom tags.
    For instance, lets say that in the above css, table {xxxxx:yyyyy} has no declaration for borders. And somewhere on the page you want to insert a small table with only a left border. Well, with regular html, when you write <table border=1>, you get a 1 pixel border on all 4 sides, but with css you can specify all 4 sides or just 1 side or 2 or 3.

    This makes for more creative designs.
    You would add an additional css style such as
    table.anyname {border-left: 1px};
    and you html would look like this:
    <table class=anyname><tr><td></td></tr></table>
    and get a table with only a border on the left side.

    You can even put ALL of the CSS in a separate file that gets downloaded and cached by the viewer. That way, when making multiple pages, all you have yop do is reference that file in the page's ,head. section. Because it's been cached by the viewer, the pages load extremely fast.

    I did an experiment in this along with grayscale color for my business web site:
    http://members.cox.net/aturrisi
    All of the content is specified in CSS, just look how small the actual source of each page is.
    No one has any right to force data on you
    and command you to believe it or else.
    If it is not true for you, it isn't true.

    LRH

  11. #11
    Senior Member Grimson's Avatar
    Join Date
    Oct 2001
    Posts
    9,590
    I'm getting confused.

    All the code looks diff. but it all does the same thing. I'm trying to let Dreamweaver do all the work until I get more familiar with this code stuff.

    I'm not taking classes, all I have is a book and websites.

    LOL


    I'm calling it a night, since I have to work early tom.

    Thanks Tony, we're not done yet.

    Crackin' skulls and breaking kneecaps.

Bookmarks

Posting Permissions

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