#media image fails to load on reduced screen - html

I have a similar issue to one of my previous questions.
when i reduce to below 975px my picture should change to a differet jpg
it seems to work locally when i redue the size of the screen but when i check on online the new image doesnt show.
As this happened previously i played with it for several hours first for fear of looking stupid, but i give up now, ill take it on the chin if any one can assist:)
HTML:
<!-- load this image on big screen -->
<div class=" jumbotron jumbotron-fluid jumbotronbrejos hideformob">
<div class="container-fluid relspan">
<img class="brejosimg" src="resources\images\brejosHouse.jpg">
<div class="jumbospan">
<h4 id="fontI">Albufeira, Algarve Portugal</h4>
</div>
</div>
</div>
<!-- load this image on smaller screens -->
<div class="container-fluid navpad">
<div class="row">
<div class="farmhouseimg farmhouse"></div>
</div>
</div> <!-- end of container -->
CSS:
/* on screens that are less than 975px */
.farmhouseimg {
background-image: url("../images/farmhouse.jpg");
background-repeat: no-repeat;
background-position: center;
background-size: cover;
margin-left:0px;
margin-right: 0px;
width:100%;
display: none;
min-height: 600px;
}
.farmhouse {
margin-bottom: 30px;
min-height: 600px;
width:100%
}
#media only screen and (max-width: 975px) {
.farmhouseimg {
display: block;
}
}
.hideformob {
display: block;
}
#media only screen and (max-width: 975px) {
.hideformob {
display: none;
}
}

Related

How to make image responsive and auto scale down the height

I have two unequal responsive columns, the smaller one on the right is text and the bigger one on the left is an image. When I resize the browser window to see how the columns fit the page, it works fine until it gets to the max width 700px and the column stack onto of each other. The bottom column is fine however the top one (image) doesn't show the full image only a tiny strip going along the width of the page. how can I get it to auto adjust the height to show the full image?
I have tried setting height on the left column as auto but that didn't work and it continued to only show a small strip.
.column {
float: left;
padding: 10px;
height: 300px;
}
.left {
width: 60%;
background-image: url('http://i.imgur.com/k5gf0zz.jpg');
background-size: cover;
background-position: center;
}
.right {
width: 40%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 700px) {
.column {
width: 100%;
}
}
<body>
<div class="row">
<div class="column left";>
</div>
<div class="column right" style="background-color:#FDE4EC;">
<center> <p><font size="8">We Provide Quality Skin Care</font></p>
<p style = "font-family: Verdana, Geneva, sans-serif">Let us help you feel beautiful!</p>
<br>
<button class="button2"><b>BOOK NOW</b></button> </center>
</div>
</div>
</body>
Any help would be very much appreciated :)
img{
max-width:100%;
height:auto;
display:none;
}
.left {
width: 60%;
background:url("http://i.imgur.com/k5gf0zz.jpg") no-repeat center;
background-size:cover;
}
.right {
width: 40%;
padding: 10px 0px;
}
.row{
display:flex;
flex-wrap:wrap;
}
#media screen and (max-width: 700px) {
.column {
width: 100%;
}
img{
display:block;
}
.left {
background:none;
}
}
<div class="row">
<div class="column left";>
<img src="http://i.imgur.com/k5gf0zz.jpg">
</div>
<div class="column right" style="background-color:#FDE4EC;">
<center> <p><font size="8">We Provide Quality Skin Care</font></p>
<p style = "font-family: Verdana, Geneva, sans-serif">Let us help you feel beautiful!</p>
<br>
<button class="button2"><b>BOOK NOW</b></button> </center>
</div>
</div>
try adding img to your html with max-width:100% and height:auto for small screens and div with background for large screens!
Remove height and add min-height
.left {
min-height: auto;
}
Thanks for your topic, I agree with Chris, if we could have more info it'd be easier to know how to help.
you can also use something like this in your html file, two pics with different sizes and to use a specific pic for every page size.
<picture id="pic">
<source media="(min-width: 650px)" srcset="image.jpg">
<img src="image2.jpg" alt="same pic bigger size" style="width:auto;">
</picture>

Bootstrap 4 fullscreen image

.ava-block {
width: 220px;
min-height: 155px;
background: url(../images/no-banner.png) no-repeat;
border-right: 1px solid #e8e8e8;
}
#media (max-width: 992px) {
.ava-block {
width: 100%;
background-size: cover;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<div class="row">
<div class="col-md-3">
<div class="ava-block" style="background-image: url(https://www.dean.ngo/wp-content/uploads/2018/12/projectElimu-220x155.png);">
</div>
</div>
</div>
I do cover, but image become with bad quality. How I can do it correctly? I need on tablets and mobile devices do fullscreen image, without quality loss and show full image. Width of image can be only 220px and height 155px.
You can't get the a small image to scale while maintaining image quality unless you make use of scalable image type such as vectors.
To solve the image going out of the ratio you could assign and max value for your inner block to ensure it doesn't exceed the maximum size which you had specified width:220 and height:155 or you can just make the size static. If my interpretation of the question is right, you may try something like the following:
.ava-block {
width: 220px;
height: 155px;
border-right: 1px solid #e8e8e8;
color: black;
}
#media (max-width: 992px) {
.ava-block {
width: 100%;
}
}
HTML
<div class="row">
<div class="col-md-3">
<div class="ava-block">
<img style='height: 100%; width: 100%; object-fit: contain' src='https://www.dean.ngo/wp-content/uploads/2018/12/projectElimu-220x155.png' />
</div>
</div>
</div>

safari not displaying header background images

In my website the top header background and the "Kreation Team" Div background are not displaying in safari on ipads and iphones but it is visible on imacs and macbooks. I mean in small devices the background images are not visible.
If you go in Chrome and safari separately you can see the difference...
Please help how to solve this?`
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="jumbotron">
<div class="container-fluid">
<nav class="row pull-right hidden-xs" style="padding:20px 20px 0 0;">
<ul style="font-size: 15px;">
<li>Home</li>
<li>About Us</li>
<li>Branches</li>
<li>Gallery</li>
</ul>
</nav>
<div class="row-fluid">
<div class="col-sm-7 col-xs-7">
<h1>KREATION <br>House of Cotton</h1>
<h2 style="font-weight: bold;padding-bottom: 30px;">Srilankan Quality Handloom Manufacturer</h2>
<button class="jumbo-btn hidden-xs" onclick="
location.href='http://kreationhandlooms.com/aboutus';" alt="Kreation House of Cotton about us page">About Us</button>
</div>
<div class="col-sm-5 col-xs-5">
</div>
</div>
</div>
</div>
CSS
.jumbotron{
background-image: url("images/silk saree.jpg");
background-size: cover;
background-position: center 10%;
background-repeat: no-repeat;
background-attachment: fixed;
height: 720px;
width: 100%;
font-family: nexabold;
margin: 0;
padding: 0;
}
#media only screen and (min-width: 510px) and (max-width: 2000px){
.jumbotron .container-fluid .row-fluid{
padding:160px 0 0 10px;
}
}
#media only screen and (min-width: 100px) and (max-width: 510px){
.jumbotron .container-fluid .row-fluid{
padding-top: 80px;
}
}
.jumbo-btn{
padding:10px 20px;
border: 3px solid white;
border-radius: 5px;
font-size: 18px;
background:transparent;
transition: all 0.4s;
}
.jumbotron h1{
font-weight: bold;
}
.jumbo-btn:hover{
background-color: grey;
color: white;
border:3px solid white;
}
#media only screen and (min-width: 200px) and (max-width: 760px){
.jumbotron .row-fluid h1{
margin:0 0 30px 0;
font-size: 45px;
font-weight: bold;
}
there was an error in console too
Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3
Your console error is due to the fact that you are not loading jQuery in your HTML. You need to add something along the lines of:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
This may also be what's causing problems with your images. If you're still experiencing issues, it helps to have a working example. Try creating a CodePen or JSFiddle with your code, and append the link to your original post.
Edit: I just took a look at your code, and the image isn't loading on Safari mobile because of background-attachment: fixed on line 214 of stylesheet.css for the CSS class .jumbotron. If you remove that from your code, the image works fine. If you need to keep the CSS for the desktop, just use a simple media query to target mobile devices.

Image doesn't scale on IE 11

When I change the width of the browser window images doesn't scale on IE 11 or below. I does work with Google Chrome. I tried to add position: absolute, but it destroying whole layout.
Image css:
.auction-item-img-container {
display: block;
height: 400px;
overflow: hidden;
position: relative;
width: 100%;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
#media screen and (max-width: 1024px ) {
.auction-item-img-container {
height: 0;
padding-bottom: 100%;
}
}
#media screen and (max-width: 480px ) {
.auction-item-img-container {
height: 270px;
}
}
Parent and img both have display: block; box-sizing: border-box;
HTML:
<article onclick="AddCookieWithAuction(1185)" id="auction-1185">
<a class="auction-item-img-container" href="/Aukcje/PodgladAukcji/1185/1/1" style="background-image: url(/Content/images/backgrounds/empty.png)"> </a>
<!-- This part is responsive -->
<div class="auction-item-desc">
<div class="auction-bar">
<h4 class="auction-bar-author">1</h4>
<h5 class="auction-bar-title">1</h5>
</div>
<div class="auction-price-container">
<div class="actual-price-holder">
<span class="auction-price-label">Cena</span>
<p class="auction-price">123 PLN</p>
</div>
<div class="auction-observe">
<a onclick="acc.onObservedButtonClick(1185, this)" class="fa fa-star-o observe-icon"></a>
<a onclick="acc.onObservedButtonClick(1185, this)" class="add-observe">Dodaj do obserwowanych</a>
</div>
</div>
<div class="auction-type-container">
<span class="auction-type">Aukcja w trakcie</span>
</div>
</div>
</article>
There is how it looks on both browsers.
IMAGE
I suggest you to see your layout here and all mobile devices, Your website is working properly in all devices. There is no meaning to watch your layout in internet explorer with resizing the screen.
Might be a little late to the party, but I found this other SO answer that might help you: https://stackoverflow.com/a/42174237/1914261
IE11 seems to have some trouble with the initial value of the flex-shrink property. If you set it to zero (it is initially set to 1), it should work

Make images stack for mobile

I am trying to create a page with two images side by side on desktop, then have those images stack for mobile. I am making my browser window smaller to simulate a smaller screen. The images are not stacking on mobile. Here's my html:
<div class="container-lp">
<div class="col-2-lp">
<h4>Interior Decorating</h4>
<div class="overlay">
<img src="http://pjstagingdecorating.com/wp-content/uploads/2015/07/Interior-Decorating-Level-1B.jpg" alt="" />
</div>
<div class="overlay"></div>
</div>
<div class="col-2-lp last-lp">
<h4 class="landing-page">Home Staging</h4>
<div class="overlay">
<img src="http://pjstagingdecorating.com/wp-content/uploads/2015/07/Home-Staging-Level-1B.jpg" alt="" />
</div>
</div>
</div>
Here is my CSS for desktop:
.container-lp {
width: 100%;
max-width: 1280px;
min-width: 320px;
margin: 0 auto;
clear: both;
}
.col-2-lp {
float: left;
width: 45%;
margin-right: 5%;
}
.last-lp {
margin-right: 0;
}
.col-2-lp img {
width: 100%;
}
And my media query:
#media only screen and (min-device-width: 320px) and (max-device-width: 600px) {
.col-2-lp {
width: 100%;
float: none;
margin: auto;
}
.last-lp {
margin-right: auto;
}
}
There is no problem in your code. You cannot test device media queries on pc browser try this instead
#media only screen and (min-width : 320px) and (max-width : 600px) {
}
if this functionality is all you need, I would suggest looking up bootstrap. You can achieve the same thing without touching the CSS like this:
<div class="container">
<div class="row">
<div class="col-sm-6"><img src="#"></div>
<div class="col-sm-6"><img src="#"></div>
</div>
</div>
Here's an example:
Set everything to be 100%, then above a certain width set it 50%, then it should go side by side.
.image {
width: 100%;
}
#media screen and (min-width: 780px) {
.image {
width: 50%;
}
}
Here's a jsfiddle that shows a simple example