`the mobile site is not displaying properly on the screen`

I'm struggling to make my website responsive on mobile devices. I'm using Bootstrap, but when viewed on a mobile device, it's not adjusting the layout properly. Other sites I've worked on automatically zoom in to display correctly on mobile.

If anyone can spot what I'm doing wrong here, any advice would be greatly appreciated!

Here's the code snippet I'm currently using:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TITLE HERE</title>

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">

<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-responsive.min.css">

<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.js"></script>

<script type="text/javascript" src="/js/modernizr-2.5.3.min.js"></script>
</head>
<body>
<div role="main">
    <header>
        <div class="container">
            <div class="row address">
                <div class="span12">
                    <h2><?=$content['address']?><br/>
                    <?=$content['city']?> <?=$content['state']?> <?=$content['zip']?></h2>
                </div>
            </div>
            <div class="row-fluid prop_info">
                <div class="span12">
                    <h3>$<?=number_format($content['price'])?>  | <?=$content['beds']?> Bedrooms  |  <?=$content['baths']?> Bathrooms  | <?=number_format($content['square_feet'])?> Square Feet |  MLS# <?=$content['mls_id']?></h3>
                </div>
            </div>
        </div>
    </header>
    <div class="container">
        <div class="row center">
            <div class="span12">
                <ul class="nav nav-pills menu">
                    <li><a href="#">VIDEO</a></li>
                    <li><a href="#">PHOTOS</a></li>
                    <li><a href="#">WALKSCORE MAP</a></li>
                </ul>
            </div>
        </div>
        <div class="container">
            <div class="row center">
                <div class="span12">
                    <div id="description-shadow-video-top"></div>
                    <iframe id="vp1HMbXI" title="Video Player" width="100%" height="auto" frameborder="0" src="<?=$content['video_url']?>" allowfullscreen></iframe>
                    <div id="description-shadow-video"></div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="row">
                <div class="span12">
                    <?=$content['main_content']?>
                </div>
            </div>
        </div>
        <br/>
        <div class="container">
            <div class="row">
                <div class="span12">
                    <div class="pull-left">
                        <br/>
                        <br/>
                        <br/>
                        <img src="/img/foundation/presented-by.png" width="120" alt="" />
                    </div>
                    <div class="pull-left">
                        <img src="/img/some_pic.jpg" alt="" name="agentImg" width="90" id="agentImg" />
                    </div>
                </div>
            </div>
            <br/>
            <div class="row center">
                <div class="span12">
                    <h3><?=$user['first_name']?> <?=$user['last_name']?></h3>
                    <br />
                    <?=$user['company']?><br /><?=$user['address']?>
                    <br />
                    <?=$user['city']?>, <?=$user['state']?> <?=$user['zip']?>
                    <br />
                    <br />
                    <?=$user['contact_number']?>
                    <br />
                    <a href="mailto:<?=$user['email_address']?>"><?=$user['email_address']?></a>
                    <br />
                    <br />
                </div>
            </div>
        </div>
    </div>
    <footer>
        <div class="container">
            <div class="span12">
                <a href="http://www.somesite.com" target="_blank">
                    <img src="/img/the_logo.png" width="210" />
            </div>
        </div>
    </footer>
</div>
</body>
</html>

Answer №1

It appears that you have utilized the span12 class exclusively in all your rows, resulting in unsegmented elements that do not adjust when the viewport changes size. Responsive grid layouts require breaking down row elements into segments to allow for layout adjustments based on viewport size.

If each main <div> within a row is set to span12, the content will retain a width=100% and only scale down as the viewport shrinks.

I recommend avoiding using span12 for every primary <div> and reconsidering the granularity of your content structure. Refer to the Twitter Bootstrap Scaffolding documentation for guidance.

Answer №2

Try implementing this layout to resolve the issue by removing the row class. TITLE HERE

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <meta content="yes" name="apple-mobile-web-app-capable">

<link rel="stylesheet" href="/css/bootstrap.min.css"> <link rel="stylesheet" href="/css/bootstrap-responsive.min.css">

<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="/js/bootstrap.js"></script>

<script type="text/javascript" src="/js/modernizr-2.5.3.min.js"></script> </head> <body> <div role="main">
    <header>
        <div class="container">
            <div class="address">
                <div class="span12">
                    <h2><?=$content['address']?><br/>
                    <?=$content['city']?> <?=$content['state']?> <?=$content['zip']?></h2>
                </div>
...
                        <a href="mailto:<?=$user['email_address']?>"><?=$user['email_address']?></a>
                    <br />
                    <br />
                </div>
            </div>
        </div>
    </footer> </div> </body> </html>

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

Center a vertically aligned element following a heading, with the content dynamically generated and enclosed in a fixed container

My mind is racing with this problem and I'm not sure if it's solvable, but before throwing in the towel, I thought I'd seek help from the Internet Gods. Here's a visual representation of what I'm aiming for: I want the text to al ...

Learn the method to conceal rows within a table simply by toggling a button

I need a function that will hide the rows below a row with a header and button, and only reveal them when another row with a header and button is clicked. When one of the +/- buttons is clicked, it should hide or expand all the rows with data content. http ...

What are some ways to maintain the aspect ratio of an image with two dimensions?

Issue: The image is taller than the img-box container https://i.stack.imgur.com/zDBLM.png I have identified two potential solutions, but I am not satisfied with them: Removing the img-box wrapper Applying max-height and max-width properties to the img t ...

Intersection of content in panel-body using bootstrap tab pills

Can someone help me solve a major issue? I need the content of each tab to overlap as if they are unaware of each other. Currently, my code is saved in this fiddle: https://jsfiddle.net/axq882de/1/. When I click on different tabs, the contents should remai ...

Alignment of a Definition List with Omissions of Definitions

Often, I come across applications with forms containing optional fields. In the Show view, these fields tend to "collapse" together and lose alignment with their corresponding labels. For instance, if I have 3 fields that should be displayed as: Phone: 3 ...

Issue with menu height persisting while resizing screen

For my responsive design project, I am implementing a menu that switches to a menu button when the width is less than or equal to 768px. Currently, I am using jQuery to dynamically adjust the height of the menu when the menu button is clicked. The jQuery ...

Tips for removing borders around a textbox with a background image: When incorporating a background image into a

After removing the default borders on a textbox using outline:none;, I noticed that adding a background image caused the border to reappear, and I couldn't get rid of it! How can I solve this issue? Here is the code for the textbox: <input type = ...

V5 Modal & jQuery: troubleshooting the spinner problem during loading of content

I'm working on displaying a spinner while loading modal content with the use of bootstrap v5 modal and jQuery. However, I encountered some issues in my example. The spinner does not display again after closing the modal; it only shows for the first t ...

Maintain a fixed element and enable the rest of the elements to scroll as the mobile browser address bar collapses while scrolling upwards

Currently facing a challenge where I want the background image to remain static while the address bar and content underneath scroll up. The image occupies 90% of the view height, and although I've prevented it from resizing and jumping when the addres ...

Is there a way to update the styling of specific sections of an input field as the user enters text in React?

Just like in most markdown editors, I am looking to enable the ability to modify parts of an input field as the user enters text. For instance: When the user types "_above_", as soon as the second underscore is typed, the text should be styled accordingly ...

The image appears fuzzy until you hover over it and it transforms into a larger size

Encountering a strange issue with using the zoom property on an image during hover state. The image seems to be blurry before and after the scale transition, but surprisingly sharp during the actual transition. Any tips on how to prevent this blurriness in ...

ever-evolving background-image with dynamic CSS styling

Being new to both PHP and Javascript, please excuse any mistakes in my explanation. I have information stored in a PHP array that I bring to my index page using the function below (located in a separate file called articles.php that is included in my index ...

Table featuring alternating background colors for rows and a distinct header design

Incorporating CSS, I have managed to style my rows in alternating colors. Take a look at the code snippet below: Fiddle tr:nth-child(odd) td { background-color:red; } tr:nth-child(even) td { background-color:blue; } tr th { background-color: yellow} ...

The Infinite Loop: Unveiling the En

I'm interested in creating a unique shape resembling the symbol of infinity using CSS, SVG, or Canvas. If you're unfamiliar with what an infinity symbol looks like, here's an example: https://i.stack.imgur.com/cLhBh.jpg So far, I've a ...

Unable to apply .png image using the content property in a Symfony project

I have a png image located in src/AppBundle/Resources/public/img To set the png image using the css content property, I used this code: content: url(../../public/assets/img/optional-checked.png); However, I encountered an error: GET http://127.0.0.1:80 ...

Expanding CSS Grid to Occupy Remaining Area

I'm currently utilizing CSS grid to construct a basic 3 column layout. Here's a snippet of my code... .container { display:grid; grid-template-columns:1fr 1fr 1fr; } ...

Adjust the class of the iframe element when clicked

I am attempting to change the class of an iframe (soundcloud embedded track) when it is clicked, in order to apply different properties. However, my code doesn't seem to be working as expected. Here is what I have: Here is a snippet from my index.htm ...

Can you show me how to achieve a smooth background color transition for a div that takes 2 seconds to complete when it is inserted into the DOM?

On my webpage, I have a list of items that are constantly being updated via a WebSocket connection to the backend. Each time a new item is added to the list, I would like it to be displayed with a background color transition lasting only a brief moment. ...

What happens when there is a 1-second delay in loading CSS on an HTML page?

Lately, I've been working on creating HTML and CSS pages. However, whenever I load a page, I notice that there's always a brief half-second flash of the HTML content without any styling applied. Does anyone have an idea why this is happening and ...

Issue with scroll down button functionality not functioning as expected

Is there a way to create a simple scroll down button that smoothly takes you to a specific section on the page? I've tried numerous buttons, jQuery, and JavaScript methods, but for some reason, it's not working as expected. The link is set up co ...