Topic: Aspect ratio of halfpage carousel layout image
Austin free asked 6 years ago
Anna Morawska staff answered 6 years ago
Hi there,
you can use nth-of-type css selector. It will look like this:
.carousel-item {
background-repeat: no-repeat;
background-size: cover;
}
.carousel-item:nth-of-type(1) {
background-position: center bottom -300px;
background-image: url(https://partysprings.com/themes/zanor-zanor-mdb-loaded/assets/images/froggers/two_girls_dancing.jpg);
}
.carousel-item:nth-of-type(2) {
....
}
If don't want to, you can instead add !important rule in your media queries:
@media only screen and (max-width: 600px) {
.carousel-item {
background-position: center bottom !important;
}
}
Best,
Ania
Austin free answered 6 years ago
Anna Morawska staff answered 6 years ago
Ok, I think I know what is the problem. I've taken a look at your website's code and I noticed that carousel-item has inline-style defined.
<div class=" view hm-black-light" style="background-image: url('https://partysprings.com/themes/zanor-zanor-mdb-loaded/assets/images/froggers/two_girls_dancing.jpg');background-repeat: no-repeat;background-size: cover;background-position: center bottom -300px;">
Inline styles overwrite all rules defined in your external stylesheet ( style.css ). I advise you to move this code
.carousel-item {
background-image: url(https://partysprings.com/themes/zanor-zanor-mdb-loaded/assets/images/froggers/two_girls_dancing.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center bottom -300px;
}
to your style.css ( put it before media queries, and delete inline styles in your html ). It should resolve your problem :)
Best,
Ania
Austin free answered 6 years ago
Anna Morawska staff answered 6 years ago
@media only screen and (max-width: 600px) {
.carousel-item {
background-position: center bottom;
}
}
It means that if the browser window is 600px or smaller, the background position will be center bottom ( without -300px )
Let me know if this resolves your problem.
Best,
Ania
Austin free answered 6 years ago
Marta Wierzbicka staff answered 6 years ago
Marta Wierzbicka staff answered 6 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No