The code functions properly in Chrome's Developer Tools, but fails to display correctly on an actual handheld

Contact form in Developer Tools

Contact form on Chrome for Mobile

Upon examining the images, it becomes apparent that the CSS is not rendering correctly on the mobile device. Media queries are being utilized for styling on mobile platforms.

<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

The viewport meta tag is already being used.

Any insights as to why this discrepancy may be occurring?

Here is the live webpage I am encountering issues with. It is a work in progress.

Edit:

This code snippet represents what was implemented initially. When pasted into a new HTML document, the CSS renders properly. However, when applied to the original page, the same CSS does not display correctly.

HTML

<html>
    <head>
        <meta charset="UTF-8">   
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

        <link href="styles.css" rel="stylesheet">
        <link href="queries.css" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Lato:100,300,300i,400" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
    </head>

    <body>
        <div class="contact-body-color">
            <div class="row">
                <div class="contact-body">
                    <form method="post" action="mailer.php" class="contact-form">
                        <div class="row">
                            <div class="">
                                <label for="fName lName">Name</label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="first-name">
                                <input type="text" name="fName" id="fName" placeholder="First name" required>
                            </div>
                            <div class="last-name">
                                <input type="text" name="lName" id="lName" placeholder="Last name" required>
                            </div>
                        </div>
                        <div class="row">
                            <div>
                                <label for="email">Email</label>
                            </div>
                            <div class="">
                                <input type="email" name="email" id="email" placeholder="Your email" required>
                            </div>
                        </div>
                        <div class="row">
                            <div>
                                <label for="find-us">Subject</label>
                            </div>
                            <div class="subject">
                                <input type="text" name="subject" id="subject" placeholder="Your subject" required>
                            </div>
                        </div>
                        <div class="row">
                            <div>
                                <label for="message">Message</label>
                            </div>
                            <div>
                                <textarea name="message" id="message" placeholder="Your message"></textarea>
                            </div>
                        </div>
                        <div class="row">
                            <div class="buttons">
                                <input type="submit" value="Send it!">
                                <input type="reset" value="Reset">
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div> 
    </body>
</html>

CSS

*   {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html,
body    {
    background-color: #fff;
    color: #555;
    font-family: 'Lato', 'Arial', sans-serif;
    font-weight: 300;
    font-size: 20px;
    text-rendering: optimizeLegibility;
    min-width: 340px;
}

.row    {
    max-width: 1140px;
    margin: 0 auto;
}


/* ----- QUOTE ----- */

.contact-body {
    width: 90%;
    margin: 50px auto;
    background-color: #92b296;
    border-radius: 20px;
    padding: 40px;
    box-shadow: inset 0px 0px 20px #000000;
}

.contact-body-color {
    background-color: #575367;
}

.contact-form {
    width: 80%;
    margin: 0 auto;
}

.contact-form .first-name {
    float: left;
    width: 50%;
}

.contact-form .last-name {
    float: left;
    width: 50%;
}

.contact-form .subject {
    width: 50%;
}

.contact-form input[type=text] {
    width: 90%;
    padding: 8px;
}

.contact-form input[type=email] {
    width: 45%;
    padding: 8px;
}

.contact-form input[type=text],
.contact-form input[type=email],
.contact-form textarea  {
    margin: 5px 0 15px 0;
    border-radius: 6px;
    border: none;
    box-shadow: 0 4px 2px -2px #666;
}

.contact-form textarea {
    height: 200px;
    padding: 10px;
    width: 100%;
}

.contact-form label {
    font-weight: 400;
    color: #333;
}

.contact-form input[type=submit], 
.contact-form input[type=reset] {
    padding: 10px;
    border: none;
    border-radius: 6px;
    background-color: #be6876;
    color: #fff;
    box-shadow: 0 4px 2px -2px #666;
    margin-right: 10px;
}

.contact-form input[type=submit]:active,
.contact-form input[type=reset]:active {
    transform: translate(2px, 2px);
    box-shadow: 0 2px 2px -2px #666;
}

Queries

/* Big tablets to 1200px (widths smaller than the 1140px row) */
@media only screen and (max-width: 1200px)   {

    .row    { padding: 0 10px; }

}

/* Small phones to small tablets: from 481px to 767px */
@media only screen and (max-width: 767px)   {


    /* ----- Contact Form ----- */
    .contact-body {
        width: 100%;
        border-radius: 20px;
        padding: 40px;
    }

    .contact-form {
        width: 100%;
        margin: 0 auto;
    }

    .contact-form .first-name,
    .contact-form .last-name,
    .contact-form .subject,
    .contact-form input[type=text], 
    .contact-form input[type=email] {
        float: none;
        width: 100%;
    }

    .contact-form input[type=text],
    .contact-form input[type=email],
    .contact-form textarea  {
        margin: 5px 0 15px 0;
    }

    .contact-form textarea {
        height: 200px;
        padding: 10px;
        width: 100%;
    }

    .contact-form label {
        font-weight: 400;
        color: #333;
    }

    .contact-form input[type=submit], 
    .contact-form input[type=reset] {
        padding: 20px;
        margin: 0;
        width: 48%;
    }

    .contact-form input[type=submit]    {
        margin-right: 2%;
    }

    .contact-form .buttons {
        width: 80%;
        margin: 0 auto;
    }


}


/* Small phones: from 0 to 480px */
@media only screen and (max-width: 480px)   {

    .row {
        padding: 0;
    }

}

Edit 2:

An issue has been identified specifically with the Chrome browser for Android. Upon testing with Firefox on the mobile device, the website functions and appears as intended.

Answer №1

After removing and then reinstalling Chrome on my mobile device, all issues were resolved. It seems that an update was needed.

Answer №2

Try adding the CSS rule display: block; within

@media only screen and (max-width: 767px)
to see if it resolves the issue you're experiencing. I tested this on my mobile browser and it worked perfectly.

.contact-form .first-name,
.contact-form .last-name,
.contact-form .subject,
.contact-form input[type=text], 
.contact-form input[type=email] {
    float: none;
    width: 100%;
    display: block;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Add HTML syntax highlighting to a text area for coding purposes

I am facing a seemingly straightforward issue, but I worry that it may be too complex for me to handle on my own. My goal is to incorporate a textarea into a webpage where users can input HTML code, click a button, and have the interpreted HTML displayed i ...

What can be achieved by combining Text Wrangler and terminal?

I'm curious about how to open an index.html file in terminal. For instance, I know that using sublime works like this: sublime index.html But what about textWrangler? And in general, how do I locate similar commands like "sublime" for any program of ...

`When utilizing $routeParams, the CSS fails to load`

Whenever I use parameters in ngRoute and go directly to the URL (without clicking a link on the site), the CSS fails to load. All my routes are functioning properly except for /chef/:id. I utilized yeoman's angular generator, and I am running everythi ...

In the world of web design, IE6 has a peculiar quirk where it still displays

This example is created to showcase a specific problem. In between two paragraphs, there's a div element with its height and line-height set to 0, along with margins at 0 as well. Ideally, the paragraphs should be right next to each other without any ...

Is it possible to style a strikethrough item in a list using CSS?

Within this list, I want to use CSS to indent any list item that drops a line. I attempted to achieve this using the following CSS: li:not(::first-line) { text-indent: 15px; } Unfortunately, it doesn't seem to be working as expected. Here is an exa ...

What is the best way to create a toggle button that can show more or show less of a text snippet with animation?

Is it possible for someone to assist me with showing a long text partially and providing a "show more" button to reveal the rest, along with a "show less" option, all with some CSS animation? I was thinking of using a font awesome arrow down icon for expan ...

Table formatting problem

I am looking to add borders only below each row in my table. td{ border-bottom-style: solid;} However, I am noticing a visible border break between columns. Can anyone advise on how to remove that? ...

Final div class nested within the HTML and styled with CSS

Is there a way to keep the last div (class) from sliding underneath? I applied margin-right to .artist_wrap. I assumed that using overflow: hidden would contain it within #music_videos_wrap, but it just disappears. Any assistance is greatly appreciated. H ...

Struggling to get the Hover feature on Link from Material-UI to function properly

I've been attempting to hover over Link from Material UI, but unfortunately, it's not working as expected. The CSS styles are not being applied for some unknown reason, and I can't seem to figure out why. Additionally, the Button class is al ...

Refreshing pre-established CSS styles

I am currently working on developing an alternative design for a website as a backup plan. Unfortunately, I am restricted in terms of changing the architecture of the system. The main stylesheet is loaded first, followed by a second one which I have contro ...

extracting an empty value from this variable

When I click on an anchor tag using this operator, the value appears blank. I have multiple divs with the same class, so I used the .each() function, but I can't figure out where I'm going wrong. The desired output is that when I click on one of ...

Exploring Laravel 4: Navigating Tables with Relational Models

Edit: error fixed I am managing two interconnected Models: Project and Task. Their relationship is defined as follows: Project.php class Project extends Eloquent { public function tasks() { return $this->hasMany('Task'); ...

Unable to display ChartJs within the same DIV on the webpage

I'm struggling to display the Pie Chart from ChartJs in the correct DIV when I click from the left DIV. Running the chart directly works fine, but I want them both on the same page in separate DIVs. I have separate HTML files for each link and they wo ...

AngularJS ui-router in HTML5 mode is a powerful combination that allows

Hey, I'm looking to implement HTML5 mode in my project. Here's how my file structure looks: mypage.de/mysub I can only make changes within the "mysub" directory. So far, I've added the following into my index.html: <base href="/mysub/ ...

Obtain offspring from a parent element using jQuery

$(document).ready(function() { $.ajax({ type: "POST", url: 'some/url', data: { 'name':'myname' }, success: function (result) { var result = ["st ...

How can I stick the footer to the bottom of the page?

I've tried numerous codes in an attempt to make the footer stay at the bottom of the page, however, none of them seemed to work. Here's my footer tag: <footer class="container py-5 navbar-fixed-bottom"> The following div is: <di ...

What strategies can I employ to ensure that my python selenium script continues to function effectively even when minimized

I'm currently working on a Python script that reads data from an input file named input_names.csv. This file contains a list of names and zip codes. The purpose of this script is to utilize this information to open up Google Chrome with Selenium, mini ...

Tips for organizing wells within bootstrap into separate columns

Looking for a way to organize my well list into two separate columns. I've included a link to my Plunker project here: https://plnkr.co/edit/35oC9Eochk6EPgKeI9he?p=preview. Below is the view section: <div class="well well-lg" ng-repeat="(key, d ...

Retrieve all parent elements from a document using Nokogiri

I have a document structured as follows: <DL><a lot of tags>...<H3>Entry 1</H3><a lot of tags>...</DL> <DL><a lot of tags>...<H3>Entry 2</H3><a lot of tags>... <DL><a lot of ta ...

Utilize a SCSS class defined in one file within a different SCSS file

In my React project, I have a day/night theme button that changes the main body color in the App.scss. It's a simple setup using body.light and body.dark. However, I need to also change the text color in the navigation bar, which is located in a diffe ...