How can I effectively crop an image in CSS for mobile?

Solved

How can I effectively crop an image in CSS for mobile?

MyEcomAgent
Excursionist
19 1 2

Hi guys,

im trying to crop an image in CSS for mobile, cause it has too much free space.

MyEcomAgent_0-1698492011304.png

Im trying to crop it, so the blue line im pointing at on the bottom, is at the red line im pointing at.

This is what i´ve try´d:

 

 

 

@media screen and (max-width: 749px) {
  img {
    height: 450px;
    margin-top: -100px;
  }
}

 

 

Greetings

Enes

Accepted Solution (1)
MyEcomAgent
Excursionist
19 1 2

This is an accepted solution.

Okay i got it, this is what i´ve done:

 

a {
  color: white;
}
@media screen and (max-width: 749px) {
  .banner__content {
    height: 300px;
    margin-top: -110px;
  }
  img {
    height: 450px;
    margin-top: -110px;
  }
}

View solution in original post

Replies 5 (5)

MyEcomAgent
Excursionist
19 1 2

myecomagent.com
PW: 2023

webwondersco
Shopify Partner
1176 169 172

@MyEcomAgent . could you please explain in detail? I have checked your website but did not get your point what you want.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
MyEcomAgent
Excursionist
19 1 2

You have to view it in mobile version, than you can the big gap there.

MyEcomAgent_0-1698566823835.png

There is just too much empty space below and above the pink image.

I couldn´t get rid of it with margin, padding or height. Maybe im doing something wrong xD

MyEcomAgent
Excursionist
19 1 2

This is an accepted solution.

Okay i got it, this is what i´ve done:

 

a {
  color: white;
}
@media screen and (max-width: 749px) {
  .banner__content {
    height: 300px;
    margin-top: -110px;
  }
  img {
    height: 450px;
    margin-top: -110px;
  }
}

PageFly-Richard
Shopify Partner
4782 1082 1749

Hi @MyEcomAgent 

This is Richard from PageFly - Shopify Page Builder App, I’d like to suggest this idea:
Online Store ->Theme ->Edit code
Assets ->Base.css

@media screen and (max-width: 767px) {
  .banner__content {
    height: 300px !important;
    margin-top: -110px !important;
  }
  img {
    height: 450px !important;
    margin-top: -110px !important;
  }
}

Hope you find my answer helpful!
Best regards,
Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


All features are available from Free plan. Live Chat Support is available 24/7.