How do you add a background image in CSS?

  • Author
    Posts
  • #387332

    tubbotwins
    Member

    I need a code to paste into the CSS editor. I was originally using this code . . .

    body {
    font-family:Arial, Helvetica, Georgia, Sans-Serif;
    font-size:12px;
    text-align:center;
    vertical-align:top;
    background:#666 url(’URL of image here‘);
    }

    . . . But it doesn’t seem to be working. Can someone sort this out for me?

    The blog I need help with is tubbotwins.wordpress.com.

    #387494

    devblog
    Member

    Assuming you do have the CSS upgrade, you do realize that where it says “URL of image here” actually goes uhm… the URL of the image you want to display right?

    Also, don’t use pixel units for font-sizes… is of bad practice. I’d recommend you using ’em’ units instead. The equivalent to 12px is .75em

    #387502

    tubbotwins
    Member

    Yeah, I know you put in the URL of a picture.

    And I haven’t purchased the Upgrade yet. I’m just “experimenting.”

    #387513

    devblog
    Member

    if you’re “experimenting” with the code you posted, of course it won’t work because the browser is interpreting your code as with bad syntax since you do need an URL path there.

    Remove the “url()” and leave just the HEX code value of the background property, you should see then that the background is gray. If you place an actual image path there, you should see such image as well.

    #387542

    tubbotwins
    Member

    Wow, you don’t get it, do you?

    #387543

    Explain what isn’t working. You are giving us nothing to go on.

    #387544

    Also explain what you want the code to do.

    #387549

    devblog
    Member

    well, you are the one asking for help, obviously you don’t know how to do it. On the other hand I know how to do it and I’ve given you solutions to what’s possible the cause of your background not being displayed despite the fact that you haven’t given more details on what you’ve been doing so far and failed.

    I can certainly diagnose and debug code, I do more than CSS on a regular basis, but reading minds and trying to decipher what you’re trying to do is certainly not my forte.

    If you find me thick enough to not get it. You might want to try Google and find your answers there, unless of course, another forum volunteer is kind enough to help you out.

    #387552

    johnlvs2run
    Member

    I might also want to experiment with the css upgrade.

    Where is the css editor located?

    #387553

    johnlvs2run
    Member

    Nevermind, I found it. Thanks.

    #387554

    johnlvs2run
    Member

    appearance > edit css

The topic ‘How do you add a background image in CSS?’ is closed to new replies.