Post by (cj) » Thu Aug 23, 2018 9:46 pm

Lots of searching, lots of reading, but nothing is giving me how to add a full screen background image into OC 3.x

I tried adding to the Header.twig file, and I tried adding to the CSS file the following:
html {
background: url(images/14277bgv1.jpg) no-repeat center center fixed; (I even tried using the full URL for the image, but- nope)
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

But that works in neither place. I'll admit I'm not too knowledgeable on css, but I thought I could get this to work. But I can't seem to figure it out. What am I missing to get a full screen (non-scrolling) background image on my site?

OpenCart 3.0.2.0
http://www.CastleGateDesign.com

(cj)
http://www.adventhouseplans.com
----
Opencart v2.3.0.2 no VQMod yet


New member

Posts

Joined
Fri Dec 17, 2010 6:17 am

Post by OSWorX » Fri Aug 24, 2018 8:19 pm

Normally the image path in OC is: image

Have you also tried (if the image and path is correct, it should work - display is as the image sizes):

Code: Select all

body { background: url(images/14277bgv1.jpg) no-repeat center center fixed; }
And if you do it this way, the image covers the whole page:

Code: Select all

body { background: url(images/14277bgv1.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }
And if you have troubles with Android devices, maybe you have to add this:

Code: Select all

height: 100%; overflow: hidden;
Just tried following on your site, and it works perfectly (before the <body tag inside the head section):

Code: Select all

<style>
    body { background: url(image/cache/catalog/homebanner/14409-Renders%20v1-1140x380.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }
  </style>

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by jbcul » Tue Sep 18, 2018 11:29 pm

I'm doing a new test install of 3.0 on localhost and had to use background-image instead of background to get it to work.

Active Member

Posts

Joined
Fri Feb 01, 2013 9:18 am
Who is online

Users browsing this forum: niagato and 630 guests