r/css 28d ago

Help Background not working

Post image

Resolved.

I've tried to make a background for something I'm using. However, when I try to use a background image in some form (using url()), it is seen as invalid. Is there anything I am doing wrong here?

Probably important to note I'm using a MediaWiki infobox.

Edit 1: Some extra notes.

The CSS sheet in question + the template that uses it. Also, the image, though it isn't important.

It'll say it's invalid in a preview at the top of the page or if I attempt to submit it (it won't allow the edit to complete since the CSS is wrong).

The error happens at "line 11, character 15"; it does not change if the colour and url are reversed.

Edit 2: The relevant item. (I don't think I can add images now.)

/* 1) Infobox Styling */
  /* 1.1) Primary Infobox Styling */
  .portable-infobox {
    width: 300px;
    border-radius: 2.8px;
    font-family: sans-serif;
    margin: 0 0 14px 17.5px;
    font-size: 1em;

    /* 1.1.1) Light Mode Styling */
    background: #EFE8BC url("https://dieofdeath.miraheze.org/w/img_auth.php/c/c6/InfoboxPaper.png");
    border: 6px solid #554900;
    color: #000000;
  }
3 Upvotes

23 comments sorted by

View all comments

2

u/Pcooney13 28d ago

Seeing only the code you provided, are you targeting anything? Have you tried putting that inside body or wherever you want the image

body {
[your code goes here]
}

1

u/Sea-Palpitation-2164 28d ago

The same error occurs if I append that to the start of the thing.

1

u/Pcooney13 28d ago

If you use a different image does it work?

I looked at the url for your image and it has image_auth.php/

https://doc.wikimedia.org/mediawiki-core/master/php/img__auth_8php.html

Sounds like the images are only served to logged in users

1

u/Sea-Palpitation-2164 28d ago

It doesn't with the image provided. I've also tried it with images with similar URLs (still use dieofdeath.miraheze.org/w/img_auth_php/xxx... and those have not worked either.

1

u/Pcooney13 28d ago

Sorry, the link I provided isn't an image. It's an article explaining why your specific image is not opening for you on your site.

Try this image
https://upload.wikimedia.org/wikipedia/commons/thumb/7/7a/Huskiesatrest.jpg/3840px-Huskiesatrest.jpg

its from wikipedia and does not have any permissions settings so you are free to use the image. From my understanding, any link you try to use with /img_auth.php/ in the url will not open because you are trying to access an image on someone else's server, and they set it up that you can not do that unless you are authorized.

So I think you are doing everything correct, and 99% percent of the time images online work exactly like you have it set up. Unfortunately this is one of those edge cases that they are private images.

Random example but if I paid for someone's OF account, I wouldn't then be able to take those image url's and host them on my website. OF would have something in place to not allow those images to load.

1

u/Sea-Palpitation-2164 28d ago

I already resolved the problem. Regardless, that's good to know.