Expanded image on mobile devices, background-fixed - css

I have a problem with the image on main page of my portfolio website. The image is expanded on mobile devices. Here I upload my CSS code.
height: 85vh;
min-height: 100%;
background-image: url('./ZdjeciaPortfolio/mainPhoto.jpg');
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
What can I do? I saw other answers on stack, but all doesn't work
Image

Related

wordpress display the full image

working with wordpress, I have created a page you can see here please do to the Schoonmaakwerk is mensenwerk as you can see it looks like this:
while the image is this:
I want to be able to display the full image. here is my code for the image part:
#mainSchoonMaker {
background: url(https://www.haagsehof.nl/content/uploads/2018/02/20171120_Haagsehof_1300_blackoverlay.jpg);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
if I add no-repeat the image is gone. I want this image to be able scroll able and goes up and dwon with scrolling of the page, anyone any idea how to do this?
Try this one:
#mainSchoonMaker {
background: url(https://www.haagsehof.nl/content/uploads/2018/02/20171120_Haagsehof_1300_blackoverlay.jpg);
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: auto;
}
Try this code.
#media (min-width:767px){
#pl-4 {
background: url(https://www.haagsehof.nl/content/uploads/2018/02/20171120_Haagsehof_1300_blackoverlay.jpg) no-repeat center center;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
margin-left: -15px;
margin-right: -15px;
}
}
#media (max-width:768px){
#pl-4 {
background: url(https://www.haagsehof.nl/content/uploads/2018/02/20171120_Haagsehof_1300_blackoverlay.jpg) no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
margin-left: -15px;
margin-right: -15px;
}
}
Are you dealing with featured images in your theme?
If so, the issue may actually be in the code for your featured image within your theme. Thumbnail (featured image) size can be determined within the media settings in your WordPress site, but featured image sizes can also be manually specified via functions. Here's the developer documentation for building-in functions like this.
https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
The image may end up being the wrong size, because WordPress is giving you a custom size automatically due to either your media settings or a theme-specific function.

bacgkgound-image css property doesn't fit the proportions on mobile devices

The code I have for an image:
.hero-image {
background-image: url('hero.jpg');
height: 620px;
background-position: center;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
It works perfectly in Chrome devtools. Here is a screenshot:
But on my phone, the image doesn't look good:
Can't figure what's wrong with the code. I tested on several phones in several browsers. But the result is the same. Is there anything that can be done to solve the issue? Thanks.

unecessary horizontal scrollbar displayed on overflow:scroll

I'm trying to make a website on a single page, with every section of the page taking up exactly the size of the user screen (using backstrech for backgrounds).
Like this: http://projects.lukehaas.me/scrollify/#home
The problem comes when the user's screen height is too small to contain my page's content. In that case, I want my background to stretch more than the user's screen, as it has to fill the entire content's background.
So, I've been using overflow:scroll, which fix the entire problem except for displaying an annoying horizontal scroll bar, even when it is not needed. What I mean is, even at full-screen when there's no overflow at all, the horizontal scrollbar appears
This is my code:
section#page1 {
background: url('../img/background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100vh;
overflow: scroll; }
try this:
section#page1 {
background: url('../img/background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100vh;
overflow-x: hidden;
overflow-y: scroll;
}
section#page1 {
background: url('../img/background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100vh;
overflow: auto;
}

image responsive issues with iphone

I’ve been able to get my images to be mobile responsive and to resize correctly except for iPhones. These are images that are loaded as background images through css. I am using media queries.
#wineClub{
background:black url('/Winery/img/winebottles3.jpg') center center no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height: 100%;
}
/*For devices 400px and larger: */
#media only screen and (min-device-width: 700px) {
#wineClub {
background-image: url('/Winery/img/winebottles2.jpg')center center no-repeat fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
}
What gives?

In Rails / bootstrap, why isn't the background image stretching properly?

I am using bootstrap and rails. I am trying to have a background image take up the entire background and stretch when the browser is larger. This is working for the most part, except when the browser is smaller the bottom of the image goes up and the bottom of the browser screen is blank. Here is the css I have now:
body {
background-image: url('bilde.jpg');
background-repeat: no-repeat;
background-position: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
I have tried this:
body {
background-image: url('bilde.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
but it does not work either. Does anyone have an answer for this problem? Thanks.
I figured it out. The difference was that I should have been using
background: url('bilde.jpg') no-repeat center center fixed;
instead of
background-image: url('bilde.jpg') no-repeat center center fixed;
Pretty subtle but the change did the trick.

Resources