SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    image in a css style sheet

    So far my external css file, looks like this:

    BODY {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #FFFFFF
    }
    BODY {

    I want to change it so that I can use a image as my background, I know how do do this in dreamweaver, but how can I include it in a css style sheet. I assume I need to replace the background colour bit, any advice would be great?

    Thanks
    Michael Prosser

  2. #2
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try

    Code:
    BODY  {background-image: url(your_iage.jpg)
    Paul

  3. #3
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or the shorter version

    Code:
    BODY {background: #FFFFFF url(your_image) }
    In the url part try to use absolute paths to avoid problems with NN and IE.

    Paul

  4. #4
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mic2020...you should change all of your CSS to lower-case attributes and values to make it xHTML compliant.

    Paul, be careful using shortcuts, I think that some browsers don't understand them properly.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    Los Angeles, California
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    creole, so it is better to make everything in CSS lowercase then uppercase?
    www.iyeinteractive.com - Website Design and Programming
    www.totalnonsense.net - my site, Under Construction

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't ALL have to be lower/upper case, but xHTML specs state that all tags and their attributes must be lower case. It will probably make it easier for you to be consistent.

    Your classes can be upper/lower just like in Javascript, but remember they are case sensitive:

    SomeClass

    someclass

    SOMECLASS (although again, I would stay away from this one)
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    shorthand properties are supported by opera, ie, netscape and mozilla browsers. so no worries about 'shortcuts'.

    make sure you do not have single quotes round your image references in your style sheet as it will not work in macintosh browsers - specifically IE5

    eg.
    background-image : url('images/image.gif'); X wrong!
    background-image : url(images/image.gif); correct!

    in addition, you can specify background-repeat.

    options are :
    repeat
    repeat-x
    repeat-y
    no-repeat
    Last edited by lynlimz; Jun 11, 2001 at 21:47.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein


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
  •