React CSS does not display on mobile devices (Chrome) unless in “View Desktop Site” enabled. Viewport Meta tag is set

Mobile Technologies Mobile Computing 2 years ago

0 0 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I'm drawing a landing page in React with multiple responsive sections. Every single responsive section is displaying correctly on my mobile device (I'm using Chrome) except for my list of articles. When I select "View Full Site" it shows up correctly using the media query for min-width 768px wide screens. It works exactly as intended in my Desktop Chrome's Responsive Inspector for all sized devices in all orientations. This is a mobile-first application; that is, the media queries apply to the larger screens, and the smaller mobile devices will use the root CSS. In other words, mobile doesn't use the @media queries. I've searched for assistance and not found a similar situation, as the rest of the page loads perfectly fine, including similar media queries. I've already set the self-closing viewport meta tag in the header of my primary index.html file: Any thoughts as to why my screen isn't resolving as expected? I'm attaching the relevant React code, CSS, and a few screenshots for comparison. HOME export class Home extends Component { state = { loggedIn: true }; render() { const { blogPosts } = this.props; return (

Plan your family's Disneyland vacation with confidence!

{blogPosts.loading || !blogPosts.list.data.length ? ( ) : ( blogPosts.list.data.map(post => ( )) )}
); } } LISTITEMGROWING (Link is imported from react-router-dom; Image is a standard img tag) export const ListItemGrowing = ({ item, className, page }) => (
{item.title}

{item.title}

{item.excerpt}

); HOME.CSS body { background: lightblue; } .home { padding-top: 20px; } .home .articles-container { display: flex; justify-content: center; width: 100%; flex-flow: column wrap; margin: 50px 0; } .home .articles-container .list-item-growing { flex: 0 0 100%; } .home .center-content { display: flex; justify-content: center; margin: 25px 5%; } .home .center-content .logo-image { background: #81ADEC; border-radius: 10px; } .home .center-content h1 { text-align: center; } @media only screen and (min-width: 420px) { .home .center-content { margin: 25px 15%; } .home .center-content .logo-image { border-radius: 25px; } } @media only screen and (min-width: 768px) { .home .articles-container { flex-flow: row wrap; } .home .articles-container .list-item-growing { flex: 0 0 50%; } } @media only screen and (min-width: 1280px) { .home .articles-container .list-item-growing { flex: 0 0 33.3333%; } } LISTITEMGROWING.CSS .list-item-growing { position: relative; height: 260px; overflow: hidden; background: #fff; } .list-item-growing .image-container { position: absolute; top: 0; left: 0; z-index: 1; } .list-item-growing .image-container .list-item-image { /* max-height: 100%; */ transition: transform 60s ease; } .list-item-growing:hover .image-container .list-item-image { transform: scale(2); } .list-item-growing .image-container .image-wrapper { width: 150%; } .list-item-growing .headline-container { position: absolute; bottom: 0; left: 0; padding: 10px 20px; height: 33%; background: rgba(255,255,255,0.9); width: 100%; display: flex; text-align: center; justify-content: center; align-items: center; z-index: 2; } .list-item-growing .excerpt-container { position: absolute; top: 15px; left: 15px; right: 15px; padding: 20px; bottom: calc(33% + 15px); background: rgba(105,20,205,0.75); color: #fff; border-radius: 5px; border: 1px solid #fff; display: flex; justify-content: center; align-items: center; transition: 0.25s; overflow: hidden; opacity: 0; z-index: 3; } .list-item-growing:hover .excerpt-container { opacity: 1; } @media only screen and (min-width: 768px) { .list-item-growing .headline-container { height: 50%; } } @media only screen and (min-width: 1280px) { .list-item-growing .headline-container { height: 33%; } } DESKTOP RESPONSIVE INSPECTOR ACTUAL MOBILE IMPLEMENTATION

Posted on 16 Aug 2022, this text provides information on Mobile Computing related to Mobile Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (0)

Post Answer

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Mobile Technologies Links