0

I have been working on my website and I'm having trouble with setting the css of my background.

This is the code that i have right now. Im trying to use only jquery and not a css file.

$('<div id="klanbot_config">').css({
    position: "absolute",
    left: 792,
    top: -7,
    width: 199,
    height: 545,
    border: "3px gold solid",
    color: "white",
    "font-size": "10px",
}).appendTo("#centerbox2");

I tried doing background: url('https://i.sstatic.net/qQQgp.jpg'), but that did not work.

2
  • Check your console. Commented Apr 27, 2017 at 3:14
  • "font-size" can be substituted with fontSize, and the comma after "10px" can go too if you are interested in micromanaging your code. Commented Apr 27, 2017 at 3:15

1 Answer 1

2

I tried doing background: url('http://i.imgur.com/Uc3QUrs.jpg'), but that did not work.

You'd need to put the url('...') part in double-quotes:

background: "url('http://i.imgur.com/Uc3QUrs.jpg')"

Otherwise you're trying to call a function called url() and set the background to its return value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.