Dec 29, 2016 05:39 PM
(This post was last modified: Dec 29, 2016 05:41 PM by iGameKing.)
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.
DO NOT DEAL WITH THIS MEMBER
Here's the image for everyone. Will take a look myself in a minute but lunch time.
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.
Dec 29, 2016 05:42 PM
(This post was last modified: Dec 29, 2016 05:42 PM by Yuikoro.)
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.
RETURNING ALL REP WITH A +3 REP.
DO NOT DEAL WITH THIS MEMBER
(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.
DO NOT DEAL WITH THIS MEMBER
Dec 29, 2016 05:50 PM
(This post was last modified: Dec 29, 2016 05:51 PM by White..)
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"); }
Dec 29, 2016 05:50 PM
(This post was last modified: Dec 29, 2016 05:52 PM by Ancestral.)
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.
RETURNING ALL REP WITH A +3 REP.
Dec 29, 2016 05:50 PM
(This post was last modified: Dec 29, 2016 05:52 PM by iGameKing.)
(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
DO NOT DEAL WITH THIS MEMBER
(Dec 29, 2016 05:52 PM)Yuikoro Wrote: My dude
Your picture is a jpg not a png
Got it!
Dec 29, 2016 05:53 PM
(This post was last modified: Dec 29, 2016 05:54 PM by Ancestral.)
(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.
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.
|