CSS seems to be ineffective on mobile devices

While testing a website, I noticed that it functions perfectly on desktop and laptop devices. However, when accessed using a mobile device, the layout is completely messed up.

You can view the example page at . All CSS and JS files are accessible in the source code. Here's an excerpt:

HTML:

<!doctype html>
...
</body>

</html>

Main Page CSS:

html, body  {
    margin:0px;
    height:100%;
}
...

#second_section {
    margin: 0px auto;
    position:relative;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

When viewed on a laptop with any browser, the page is responsive as expected when resized. However, on a mobile device, the page fails to load properly.

Will all the CSS files load correctly on a mobile device?

I have created 3 CSS files for different screen widths. If the mobile device only loads css/deco_649.css, this could explain why the styling is not rendering correctly.

Answer №1

Your "deco_full.css" file contains a CSS selector that defines the image background for #first_section:

#first_section {
    background-image: url(../images/bg_low.jpg);
    background-size: cover;
}

This CSS rule only applies when the device screen width is at least 1000px. Make sure to include similar definitions in your other CSS files for mobile and tablet devices as well, with potentially different images for those backgrounds.

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

A variant of setTimeout designed specifically for family members

I am currently working on a program that involves creating a "health" variable which decreases by random amounts at random intervals. This means that a player may encounter scenarios like the following: 5 seconds Lose 20 health 3 more seconds Lose 25 healt ...

Implementing tooltips that require a click instead of hovering

How can I make a JavaScript tooltip only appear when clicking on an element instead of hovering over it? I tried the following code: var selection = canvas.selectAll("circle").data(data); selection.enter().append("circle"); canvas.append("svg:circle") ...

Issue with displaying the second dropdown based on the selection made in the previous dropdown

I wanted to address a recurring issue that has been discussed in various posts, such as this one on Stack Overflow: Show a second dropdown based on previous dropdown selection Despite attempting numerous solutions suggested in those posts, I have not been ...

What could be causing my React button to stop functioning as a link to an external website when using anchor tags?

I recently created some buttons for my website using React. Initially, everything was working perfectly with the buttons, but suddenly they stopped functioning. Strangely, I didn't make any alterations to the code and I'm puzzled as to why they a ...

Tips for creating responsive scrollable columns in an HTML table with Bootstrap

I'm not a professional web designer. I attempted to create a web layout with scrollable columns containing data in anchor tags that are loaded dynamically. To achieve this, I created an HTML table structure along with a stylesheet. Here is the source ...

Replacing elements with preg_replace in HTML including diacritics

Can someone assist me in using preg_replace for the following scenario: <p style="background:white"> <span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;"> Coût de la prestation : 43.19 . ...

"Exploring the Functionality of Page Scrolling with

Utilizing Codeigniter / PHP along with this Bootstrap template. The template comes with a feature that allows for page scrolling on the homepage. I have a header.php template set up to display the main navigation across all pages. This is the code for th ...

Trouble with ID.Replace function

Within my gridview, I am trying to extract the ID of a row when it is clicked. The ID returned looks like gvBookingsRow_5. $(".gvBookingsRow_").click(function (e) { ShowBookingComment($(this).attr("ID")); ...

What is the best approach to create a JavaScript search filter function spanning two pages?

Page1.html has a form with a drop-down menu containing options Color and Shape. There is also a submit button. Assuming Page2.html displays various shapes like Blue Square, Red Square, Blue Circle, Red Circle, is it feasible to create a JavaScript file th ...

Tips for updating a table using jquery ajax

I have a table displayed below. I am using an ajax call to update the content of this table, and it is properly reflected in the database. However, I'm looking for a way to refresh just the table without having to reload the entire page. Any guidance ...

Bootstrap - Custom CSS styles applied to specific grid prefixes

I am currently working on developing a mobile site using bootstrap and I have a need to apply different CSS rules based on the grid prefix: col-xs, col-sm Here is a snippet of the HTML code: <header class="col-xs col-sm"> Hi </header> For ...

Centered Tailwind CSS logo design

Here is my current fiddle: https://jsfiddle.net/w5c36epd/ Upon close inspection, you may notice that the logo is not properly centered. I have experiment with various flexbox options such as: <div class="flex-shrink-0 justify-center"> ...

Conflicting jQuery slide effects and jQuery UI positioning causing issues

As you hover over an element, the position function adjusts its left attribute to the correct value. However, when you move the mouse away, it resets back to 0, causing the element to appear below the first one in the list. This issue is noticeable when y ...

"Sending image data in base64 format to a server: A step-by

Instead of directly selecting an image, I decided to dynamically display it using base64 encoding. <img style="width: 412px;" src="data:image/gif;base64,R0lGODlhwAAAAXAAACH5BAEAAPwALA Is there a way to send this image to a server without triggering a ...

Error in viewpoint/transformation transition on Microsoft Edge

Encountering a peculiar issue with MS Edge involving the animation of a door (a div tag) around the Y axis using the css rotateY() function in combination with perspective properties. The problem arises when transitioning an angle from a positive value to ...

unable to alter color using CSS

So I've heard that the CSS code is good. Here is the HTML code I am using: <DOCTYPE! html> <html lang="nl"> <head> <title>The White Stripes!</title> <link rel="stylesheet" type="text/css" href="home.css"& ...

When the button with an image is clicked, it will display a loading element

I have developed an application that heavily utilizes ajax, and I am looking to implement the following functionality: I would like to have a button with both text and an image. When this button is clicked, it should be disabled, and instead of the origina ...

Using ajax to retrieve and refresh data

I need to perform real-time updates to a column in my table and display the updated data instantly. Here is the code I am using: <html> <body> <div id="output"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3. ...

Make sure that the contents of the div are all displayed on a single line

After searching for solutions here, I attempted the suggested code but unfortunately, it did not produce the desired outcome. My goal is to have all the alphabet letters appear on a single line. Kindly disregard my utilization of inline elements: <div ...

Discovering information from a URL through JSON

Can someone help me with loading and displaying this JSON data? I attempted the following code, but unfortunately, it did not work as expected. <script> $(document).ready(function(){ $.getJSON("http://eolis-sante.com/eolis/connexion.php? ...