Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Little problem with to insert an image

Hi hackforums!
I face a little problem , just started when i try build my first website.
I've try to insert an image to the background of my site in the body part.

This one is on the .css file
PHP Code

<?php 
body
{
      
background-image: url("./images/a.png");
} 

This one is from the index.html file
PHP Code

<?php 
<link rel="stylesheet" type="text/css" href="./css/style.css"> 

So this is my folder situation look like this..
https://gyazo.com/da3e9d8eac848dc04bb43a797a586741

I've keep try all, check on syntax websites, if i've writing something wronge but i dont know why this basic sh*t cant work right. The background page is totaly white without my image.
Here's the image for everyone. Will take a look myself in a minute but lunch time.

[Image: da3e9d8eac848dc04bb43a797a586741.png]
Code
"<link rel="stylesheet" type="text/css" href="./css/style.css">

Should it not be

Code
<link rel="stylesheet" type="text/css" href="/css/style.css">

You have the dir wrong?
If you always do what you’ve always done, you’ll always get what you’ve always got.
I'm running on two hours of sleep so forgive me if I'm being retarded but in my current state I'm 100% certain that ./ for a path means "parent, and go here".
Try getting rid of that dot.

Ah shit dud I got sniped
(Dec 29, 2016 05:41 PM)Lucifer's Inferno Wrote:  
Code
"<link rel="stylesheet" type="text/css" href="./css/style.css">

Should it not be

Code
<link rel="stylesheet" type="text/css" href="/css/style.css">

You have the dir wrong?

Already try it too, with the dot or not but the page dont want know nothing about insert my image
(Dec 29, 2016 05:43 PM)iGameKing Wrote:  Already try it too, with the dot or not but the page dont want know nothing about insert my image

../images/a.png

Try that. Let me know.

.. will bring back to root.
[Image: woVTLnT.gif]

RETURNING ALL REP WITH A +3 REP.
(Dec 29, 2016 05:43 PM)iGameKing Wrote:  Already try it too, with the dot or not but the page dont want know nothing about insert my image

Can you play with the directory of the image? Just shove it all in 1 path/folder and see if it works.
Cbf checking everything
(Dec 29, 2016 05:44 PM)Ancestral Wrote:  ../images/a.png

Try that. Let me know.

.. will bring back to root.

I know the basic how paths work and already try it too.
Your index.html should look like

PHP Code

<?php 
<link rel="stylesheet" type="text/css" href="css/style.css"> 

For the CSS use

PHP Code

<?php 
body 
{
      
background-image: url("/images/a.png");
} 
Code
body
{
      background-image: url('./images/a.png');
}

Try that. Might not do anything.

Also, can you post your whole CSS in a pastebin? Or upload your whole site to a free host or something so we can see what's going on.

Might be a div overlapping where your image is.
[Image: woVTLnT.gif]

RETURNING ALL REP WITH A +3 REP.
(Dec 29, 2016 05:44 PM)Mr. Robot Wrote:  Can you play with the directory of the image? Just shove it all in 1 path/folder and see if it works.
Cbf checking everything

Let's give a try..

The situation look like this now..

Style.css
PHP Code

<?php 
body
{
      
background-image: url("a.png");
} 

Index.html
PHP Code

<?php 
<link rel="stylesheet" type="text/css" href="style.css"> 

and the folder look like this
https://gyazo.com/fa5e328759650b3ac9baec699a281e83

And dont work..
My dude
Your picture is a jpg not a png
(Dec 29, 2016 05:52 PM)Yuikoro Wrote:  My dude
Your picture is a jpg not a png

[Image: 1f44a.png?v7]

Got it!
(Dec 29, 2016 05:52 PM)Yuikoro Wrote:  My dude
Your picture is a jpg not a png

Haha, problem solved.

Roll out boys.

NEXT TIME USE THE NETWORK TAB IN THE CHROME DEVELOPER TAB PLEASE.

It'll tell you whether or not an image is linked properly.
[Image: woVTLnT.gif]

RETURNING ALL REP WITH A +3 REP.
(Dec 29, 2016 05:50 PM)iGameKing Wrote:  Let's give a try..

The situation look like this now..

Style.css
PHP Code

<?php 
body
{
      
background-image: url("a.png");
} 

Index.html
PHP Code

<?php 
<link rel="stylesheet" type="text/css" href="style.css"> 

and the folder look like this
https://gyazo.com/fa5e328759650b3ac9baec699a281e83

And dont work..


Your picture is JPG not a PNG.

🤝🤝🤝
If you always do what you’ve always done, you’ll always get what you’ve always got.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by srcsameerMar 10, 2017 10:37 AM 4 230 Mar 10, 2017 10:37 AM
Last Post: srcsameer
[MyBB] by SIM-1169085Mar 20, 2016 10:09 AM 2 135 Mar 20, 2016 10:09 AM
Last Post: Cap
by UnturnedApr 12, 2015 03:14 PM 1 89 Apr 12, 2015 03:14 PM
Last Post: brewery