Background image
- RAC
- Member
- Posts: 66
- Joined: Mon Apr 19, 2021 5:36 am
- Phoenix Version: v1.1.0.6
- Has thanked: 9 times
- Been thanked: 1 time
Background image
Hello all, I am trying to get a background image to show with no success.
The image has been uploaded to the images folder.
I copied the below user.css file from my old oscommerce site to the override/static folder for the image to show, along with a change in font, the font seems to work fine but the image does not. Any ideas
body {
background-image: url("dir/images/background.png");
}
body {
font-family: "Comic Sans MS", Verdana, "Times New Roman", Georgia, Serif;
}
p {
font-size: 14px;
}
The image has been uploaded to the images folder.
I copied the below user.css file from my old oscommerce site to the override/static folder for the image to show, along with a change in font, the font seems to work fine but the image does not. Any ideas
body {
background-image: url("dir/images/background.png");
}
body {
font-family: "Comic Sans MS", Verdana, "Times New Roman", Georgia, Serif;
}
p {
font-size: 14px;
}
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Background image
The CSS file is located at; /templates/override/static/user.css
Therefore any reference inside that CSS file would ref /static/
In that file you have background-image: url("dir/images/background.png");
Thus, I believe that this would need an image located at;
/templates/override/static/dir/images/background.png
--
To use an image from the standard /images/ directory, change the CSS to;
../../../images/background.png
--
../ means down a `folder`.
So from /templates/override/static/
../ - you are now in override
../ - you are now in templates
../ - you are now in `root`
images/ you are now in images
Therefore any reference inside that CSS file would ref /static/
In that file you have background-image: url("dir/images/background.png");
Thus, I believe that this would need an image located at;
/templates/override/static/dir/images/background.png
--
To use an image from the standard /images/ directory, change the CSS to;
../../../images/background.png
--
../ means down a `folder`.
So from /templates/override/static/
../ - you are now in override
../ - you are now in templates
../ - you are now in `root`
images/ you are now in images
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
- RAC
- Member
- Posts: 66
- Joined: Mon Apr 19, 2021 5:36 am
- Phoenix Version: v1.1.0.6
- Has thanked: 9 times
- Been thanked: 1 time
Re: Background image
Hello Burt,
Sorry for the slow reply, but this has had me scratching my head.
Just for clarity, the background image is my own 75kb png image.
How I initially had it set up, the font had changed but the image background.png did not work.
Now following your instructions the image still does not work, the font works in product descriptions, but not the titles, or information links.
Sorry for the slow reply, but this has had me scratching my head.
Just for clarity, the background image is my own 75kb png image.
How I initially had it set up, the font had changed but the image background.png did not work.
Now following your instructions the image still does not work, the font works in product descriptions, but not the titles, or information links.
-
14Steve14
- Senior Contributor
- Posts: 921
- Joined: Fri Oct 25, 2019 7:01 pm
- Phoenix Version: v1.0.9.1
- Has thanked: 17 times
- Been thanked: 103 times
Re: Background image
Hi
This may be different in later versions but in 1.0.9.0 this works.
Save your image in the images folder
In your override css file try adding the following, which can be adjusted if required
Then create a copy of your \templates\override\includes\components\header.php in your override components folder and change
to
Doing it that way I have an image of a train fully behind all the header as per the attached image on my test site
This may be different in later versions but in 1.0.9.0 this works.
Save your image in the images folder
In your override css file try adding the following, which can be adjusted if required
Code: Select all
.{
background-image: url('/images/your image.jpg');
background-repeat: no-repeat;
background-position: center;
position: relative;
}Code: Select all
<div class="row">
<?= $Template->get_content('header') ?>
</div>Code: Select all
<div class="bgImgCenter row">
<?= $Template->get_content('header') ?>
</div>You do not have the required permissions to view the files attached to this post.
- RAC
- Member
- Posts: 66
- Joined: Mon Apr 19, 2021 5:36 am
- Phoenix Version: v1.1.0.6
- Has thanked: 9 times
- Been thanked: 1 time
Re: Background image
Hi Steve,
I have my image repeating throughout.
How would I achieve this?
I have my image repeating throughout.
How would I achieve this?
You do not have the required permissions to view the files attached to this post.
- RAC
- Member
- Posts: 66
- Joined: Mon Apr 19, 2021 5:36 am
- Phoenix Version: v1.1.0.6
- Has thanked: 9 times
- Been thanked: 1 time
Re: Background image
OK, so the font has been sorted, this was done by installing summernote WYSIWYG in the admin.
However no matter how I attempt to show this background image, nothing seems to work.
Any other ideas?
However no matter how I attempt to show this background image, nothing seems to work.
Any other ideas?
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Background image
I can say with near-certainty that your bg image is probably not located at the place where the CSS says it ought to be.
Sharing a link to your site might help someone to diagnose further for you.
Sharing a link to your site might help someone to diagnose further for you.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
- RAC
- Member
- Posts: 66
- Joined: Mon Apr 19, 2021 5:36 am
- Phoenix Version: v1.1.0.6
- Has thanked: 9 times
- Been thanked: 1 time
Re: Background image
I expect you are right!!! I can't seem to see the wood for the trees!
Site link :
https://development.retro-antiques-curi ... /index.php
templates/override/static/user.css
/* user.css ----------------------------------------------------------------- */
body {
background-image: url("dir/images/background.png");
}
Site link :
https://development.retro-antiques-curi ... /index.php
templates/override/static/user.css
/* user.css ----------------------------------------------------------------- */
body {
background-image: url("dir/images/background.png");
}
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Background image
https://development.retro-antiques-curi ... /index.php
says the CSS is at;
https://development.retro-antiques-curi ... c/user.css
says the bg image is at;
dir/images/background.png
--
Therefore the image file needs to be called background.png
and located at
--
Whereas you have saved it at;
--
In as plain english as I can...
copy this file:
/dir/images/background.png
to:
/dir/templates/override/static/dir/images/background.png
OR
add
to the CSS part that calls the bg image.
Do one or the other, not both. If ../../ does not work, add another ../
Remember to hard refresh your browser in between changes to ensure it picks up the CSS data.
says the CSS is at;
https://development.retro-antiques-curi ... c/user.css
says the bg image is at;
dir/images/background.png
--
Therefore the image file needs to be called background.png
and located at
Code: Select all
https://development.retro-antiques-curios.co.uk/dir/templates/override/static/dir/images/background.pngWhereas you have saved it at;
Code: Select all
https://development.retro-antiques-curios.co.uk/dir/images/background.pngIn as plain english as I can...
copy this file:
/dir/images/background.png
to:
/dir/templates/override/static/dir/images/background.png
OR
add
Code: Select all
../../Do one or the other, not both. If ../../ does not work, add another ../
Remember to hard refresh your browser in between changes to ensure it picks up the CSS data.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
Omar_one
- Senior Contributor
- Posts: 677
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: Background image
you can try it like this
Code: Select all
body {
background-image: url("https://development.retro-antiques-curios.co.uk/dir/images/background.png");
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
height: 100%;
}