Mobile Devices Experiencing Issues with Centered Background Image Display

After designing a website that was meant to be responsive for mobile devices, I faced an unexpected issue. While it worked perfectly on my old Android phone, newer smartphones such as iPhones and modern Androids using Google Chrome displayed the homepage with the background image cut off halfway.

If you want to see the problem yourself, feel free to visit or check out this screenshot:

Admittingly, I am still learning CSS and might have overlooked a simple mistake causing this issue. However, I've been unable to figure it out so far.


    <html>
<head>
<title>The Story of Love</title>

<meta name="viewport" content="width=device-width;">

<style>

    #wrap { 
      width: 500px; 
      margin: 0 auto;
     }
        .
        .
        .
        

    .love2 {
        position: top center;
        top: 372px;
        left: 0px;
        height: 78px;
        width: 320px;
    }
        .love2 a {
            display: block;
            width: 100%;
            height: 100%;
        }
    }

</style>
</head>

<body>
<div id="wrap">
    .
    .
    .
    
    </div>
</body>
</html>

Answer №1

 #container { 
  width: 500px; 
  margin: 0 auto;
 }

For instance, when viewed on an iPhone, the content may be cut off since it has a width of only 320px. To address this issue, you can include the following code:

@media screen and (max-width: 320px){
       #container { 
        width: 320px!important; 
       }
}

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

Employing HTML and CSS to restrict the number of characters in sentences

Extracting a few sentences from a JSON file and displaying it in a <p> tag. <p> Thank you all for another wonderful night spent together this past Sunday at The Hippodrome in Baltimore. Thank yo... <p> I want to f ...

Arrange radio buttons vertically in a table

I am attempting to display a vertical list of radio buttons within a table cell. Is this achievable? Here is the code snippet I am currently working with: <table> <tr> <td> First Name </td> ...

Having issues with CSS list hovering functionality in Google Chrome

One of the challenges I'm facing with my HTML list is that when hovering over each list item, the text along with the bullet point should change color. Here's the structure: <ul> <li>A bullet point</li> <li>Another ...

unordered list tag not successfully transmitting data to the $_POST superglobal array

Can someone help me figure out how to send the selected option from a dropdown menu in a form to a PHP $_POST variable? I've tried following a solution from this post without success. The dropdown menu is part of a signup form I found on this bootstr ...

Having trouble with Jquery's Scroll to Div feature?

When I click on the image (class = 'scrollTo'), I want the page to scroll down to the next div (second-container). I've tried searching for a solution but nothing seems to work. Whenever I click, the page just refreshes. Any help would be gr ...

Conceal / reveal minuscule letters

Is it feasible to hide or select only the lowercase characters of a string using CSS? <p>Richard Parnaby-King</p> How can I display just RPK? While ::first-letter allows me to show the letter R, is there a way to go further with this? p ...

What is the best way to align a jQuery Cycle 2 Slider in the middle of the

Having some trouble centering a jQuery Cycle 2 Slider on my page. You can see the slider here. I've attempted multiple methods to center it, but none have been successful. Check out the HTML code: <div class="slider"> <div id=outside> ...

Tips for connecting a suspended div below a Bootstrap 5 fixed navigation bar

I successfully implemented a sticky navigation using Bootstrap 5, and now I want to add a hanging div (.chat-tag) below the sticky nav for a chat feature. This "hanging tag" should stay attached to the sticky nav as the user scrolls down the page. It&apos ...

To modify the color of text in a mat-list-option item

Using the mat-selection-list component, I have set up a list of contacts displayed through mat-list-option: https://i.sstatic.net/ri4lP.png Currently, the background-color changes when I click on a specific contact-name (e.g. Graeme Swan), and it remains ...

Using display:inline-block will increase the vertical spacing

I am currently dealing with the following HTML and CSS setup: * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } body { margin: 0; } .row { background-color: red; /* display: inline-block; */ } ul { ...

Determine in Jquery if all the elements in array 2 are being utilized by array 1

Can anyone help me figure out why my array1 has a different length than array2? I've been searching for hours trying to find the mistake in my code. If it's not related to that, could someone kindly point out where I went wrong? function contr ...

The floating label appears distorted when used with a datalist input in Bootstrap 5

How can I get the floating label to display correctly for datalists in Bootstrap 5? Currently, it looks like this... It's working fine without the form-floating class, but I want to use the floating form feature. <div class="form-floating" ...

Overlapping sliding toggles with jQuery on multiple elements

Just starting out with jQuery and I've come across a few examples of slideToggle but they are all overlapping. Here's the code I have so far: jQuery: <script src="jquery-1.9.1.js"> </script> <script> $ (document).ready(fun ...

What could be causing my CSS to not display properly on GitHub Pages?

Currently working on a web-based game project called Sweet Shoppe, and utilizing GitHub Pages for hosting. However, encountered an issue where the CSS does not seem to be functioning properly on GitHub Pages. Attempted placing the CSS file in the main rep ...

A simple way to set a button as active when clicked in a form element

Is there a way to activate the input button with an Onclick event? <div class="paForm-right"> <form onsubmit="" name="form1" id="form1" method="post"> <input type="submit" class="paForm-choose" id="paForm-bottom-vk" value="Visi ...

Expanding lists across multiple lines

I've been struggling with the following code and can't seem to figure out how to make the text break and display below the image similar to a table. <ul style="display:block inline; list-style:none;"> <li style="display:inline"><i ...

Arrange the items in AngularJS using ng-repeat from horizontal to vertical orientation

I am currently using ng-repeat on floated left <li> elements, resulting in a horizontal list. Is there a way to repeat the same items vertically as shown below? from: Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 to: Item1 ...

Font file collection

I'm struggling to incorporate a custom font into my WordPress website and could really use some assistance. Currently, within my theme directory, I have a 'font' folder where I've placed my 'Museo300-Regular.otf' file alongsi ...

Stop vertical scrolling in a designated div container

I am dealing with a div that is overflowing, but the horizontal scroll bar is not visible. How can I prevent actual scrolling on the div when the user attempts to scroll using the mouse or arrow keys? Below is the code for this div and a snapshot <!- ...

Consider also scaling in relation to the vertical aspect

.container { width: 250px; height: 250px; resize: both; overflow: auto; border: 1px dashed black; } .child { position: relative; max-width: 300px; max-height: 150px; background-color: blue; color: red; aspect-ratio: 2 / 1; } <div ...