OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Angular 18 - background image not showing up on mobile device but works in browser and chrome tools

  • Thread starter Thread starter CStreet
  • Start date Start date
C

CStreet

Guest
I decided to redo my personal website (www.coltstreet.com), and I am using media queries to display different background images. Everything is working fine on desktop and I was using chrome tools to test the various device sizes and those all showed up fine as well.

After deploying my site, it works on desktop and in chrome tools but not when I pull it up on my actual phone. And I have no idea how to fix this. I tried resizing the image from the first size I had it but that didn't work. I've tried the chrome browser on my phone and safari, neither work, nor does a different persons phone. So it must be something with the coding.

This is my styles.

Code:
.showcase-button {
    position: absolute;
    right: 30px;
    bottom: 30px;
}

.showcase:hover {
    opacity: 0.7;
    cursor: pointer;
}

.about-me-section {
    background: url("/assets/about-me-bk.png");
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: #F7F7F7 !important;
}



.home-section {
    background: url("/assets/home-bk.png");
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: white !important;
    font-size: 12px !important;
}

@media (max-width: 480px) {
    .home-section {
        background: url("/assets/home-bk-phone.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
    }
}

@media (min-width: 481px) and (max-width: 1024px) and (orientation: portrait) {
    .home-section {
        background: url("/assets/home-bk-tablet-vert.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
    }
}

@media (max-width: 1024px) and (min-width: 481px) and (orientation: landscape) {
    .home-section {
        background: url("/assets/home-bk-tablet.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
    }
}

@media (max-width: 480px) {
    .about-me-section {
        background: url("/assets/about-me-bk-phone.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
        font-size: 16px !important;
    }
}

@media (min-width: 481px) and (max-width: 1024px) and (orientation: portrait) {
    .about-me-section {
        background: url("/assets/about-me-bk-tablet-vert.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
    }
}

@media (max-width: 1024px) and (min-width: 481px) and (orientation: landscape) {
    .about-me-section {
        background: url("/assets/home-bk-tablet-vert.png");
        background-position: bottom center;
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: contain;
    }
}

And here is my HTML:

Code:
<app-header></app-header>
<div #home name="home" class="h-screen home-section">

</div>
<div #portfolio name="portfolio" class="h-full bg-gray-100">
  <div class="grid m-0 pt-6">
    <div class="col-12 lg:col-6 relative showcase" (click)="goToLink(1)">
      <img src="assets/natrium-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
    </div>
    <div class="col-12 lg:col-6 relative showcase lg:mt-8" (click)="goToLink(2)">
      <img src="assets/urban-sweets-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
    </div>
    <div class="col-12 lg:col-6 relative showcase" (click)="goToLink(3)">
      <img src="assets/carolecolt-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
    </div>
    <div class="col-12 lg:col-6 relative showcase lg:mt-8" (click)="goToLink(4)">
      <img src="assets/hoopfire-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
    </div>
  </div>
</div>
<div #about name="about" class="h-screen about-me-section">
  <div class="flex h-full p-8 lg:p-0 lg:justify-content-end lg:align-items-center">
    <div class="w-full text-center lg:text-right lg:w-5 lg:mr-8 lg:text-3xl">
      <p style="background: #ffffffa8;">
        I am a full stack developer with a personal priority focus on front end development and web design. I currently
        reside
        in Charlotte, NC. and work for Data Ventures. Developing unique and engaging websites and web applications is a
        passion of mine. Most of my current work (along with this website) exhibits my proficiency in the utilization of
        Angular. However, I enjoy expanding my knowledge by learning new and exciting languages that will help to further
        my
        craft in web development.
      </p>
      <p style="background: #ffffffa8;">
        When I'm not immersed in code and web applications, I enjoy sports of almost any kind. Because of the complexity
        and
        spontaneity of these two worlds, finding ways to incorporate web design and sports has become a passion of mine.
        Apart
        from this, my aspirations include exploring new ways to display and interact with the user, regardless of the
        content.
        Overall, I enjoy building websites and creating web applications, watching movies and playing basketball with my
        amazing wife (3x Co-Ed league champs), hanging out with our adorable Miniature Dachshund, watching my son grow up,
        sipping on a nice cold beer, and just enjoying what life decides to throw at me.
      </p>
    </div>
  </div>
</div>
<p>I decided to redo my personal website (<a href="https://coltstreet.com" rel="nofollow noreferrer">www.coltstreet.com</a>), and I am using media queries to display different background images. Everything is working fine on desktop and I was using chrome tools to test the various device sizes and those all showed up fine as well.</p>
<p>After deploying my site, it works on desktop and in chrome tools but not when I pull it up on my actual phone. And I have no idea how to fix this. I tried resizing the image from the first size I had it but that didn't work. I've tried the chrome browser on my phone and safari, neither work, nor does a different persons phone. So it must be something with the coding.</p>
<p>This is my styles.</p>
<pre><code>.showcase-button {
position: absolute;
right: 30px;
bottom: 30px;
}

.showcase:hover {
opacity: 0.7;
cursor: pointer;
}

.about-me-section {
background: url("/assets/about-me-bk.png");
background-position: center center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
background-color: #F7F7F7 !important;
}



.home-section {
background: url("/assets/home-bk.png");
background-position: center center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
background-color: white !important;
font-size: 12px !important;
}

@media (max-width: 480px) {
.home-section {
background: url("/assets/home-bk-phone.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
}
}

@media (min-width: 481px) and (max-width: 1024px) and (orientation: portrait) {
.home-section {
background: url("/assets/home-bk-tablet-vert.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
}
}

@media (max-width: 1024px) and (min-width: 481px) and (orientation: landscape) {
.home-section {
background: url("/assets/home-bk-tablet.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
}
}

@media (max-width: 480px) {
.about-me-section {
background: url("/assets/about-me-bk-phone.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
font-size: 16px !important;
}
}

@media (min-width: 481px) and (max-width: 1024px) and (orientation: portrait) {
.about-me-section {
background: url("/assets/about-me-bk-tablet-vert.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
}
}

@media (max-width: 1024px) and (min-width: 481px) and (orientation: landscape) {
.about-me-section {
background: url("/assets/home-bk-tablet-vert.png");
background-position: bottom center;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: contain;
}
}
</code></pre>
<p>And here is my HTML:</p>
<pre><code><app-header></app-header>
<div #home name="home" class="h-screen home-section">

</div>
<div #portfolio name="portfolio" class="h-full bg-gray-100">
<div class="grid m-0 pt-6">
<div class="col-12 lg:col-6 relative showcase" (click)="goToLink(1)">
<img src="assets/natrium-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
</div>
<div class="col-12 lg:col-6 relative showcase lg:mt-8" (click)="goToLink(2)">
<img src="assets/urban-sweets-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
</div>
<div class="col-12 lg:col-6 relative showcase" (click)="goToLink(3)">
<img src="assets/carolecolt-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
</div>
<div class="col-12 lg:col-6 relative showcase lg:mt-8" (click)="goToLink(4)">
<img src="assets/hoopfire-showcase.png" alt="Image" class="w-full border-round-3xl shadow-4">
</div>
</div>
</div>
<div #about name="about" class="h-screen about-me-section">
<div class="flex h-full p-8 lg:p-0 lg:justify-content-end lg:align-items-center">
<div class="w-full text-center lg:text-right lg:w-5 lg:mr-8 lg:text-3xl">
<p style="background: #ffffffa8;">
I am a full stack developer with a personal priority focus on front end development and web design. I currently
reside
in Charlotte, NC. and work for Data Ventures. Developing unique and engaging websites and web applications is a
passion of mine. Most of my current work (along with this website) exhibits my proficiency in the utilization of
Angular. However, I enjoy expanding my knowledge by learning new and exciting languages that will help to further
my
craft in web development.
</p>
<p style="background: #ffffffa8;">
When I'm not immersed in code and web applications, I enjoy sports of almost any kind. Because of the complexity
and
spontaneity of these two worlds, finding ways to incorporate web design and sports has become a passion of mine.
Apart
from this, my aspirations include exploring new ways to display and interact with the user, regardless of the
content.
Overall, I enjoy building websites and creating web applications, watching movies and playing basketball with my
amazing wife (3x Co-Ed league champs), hanging out with our adorable Miniature Dachshund, watching my son grow up,
sipping on a nice cold beer, and just enjoying what life decides to throw at me.
</p>
</div>
</div>
</div>
</code></pre>
Continue reading...
 

Latest posts

A
Replies
0
Views
1
Ashrik Ahamed
A
A
Replies
0
Views
1
Ashrik Ahamed
A

Online statistics

Members online
1
Guests online
3
Total visitors
4
Top