`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

The persistent Bulma dropdown glitch that refuses to close

In the project I'm working on, I have implemented a Bulma dropdown. While the dropdown functions correctly, I am facing an issue when adding multiple dropdowns in different columns with backend integration. When one dropdown is open and another is cli ...

What is the best way to display multiple files in a vertical stack when choosing a file?

<div class="selected-file-container align-items-center justify-content-between d-none"> <div class="selected-file d-flex align-items-center"> <img id="selectedImage" class="hidden" src="&qu ...

Creating a visually appealing background image using WordPress and PHP

Currently struggling with adjusting the width of an image that's set as a background in Wordpress. The text is perfectly centered, but the background image remains full size and I want it to match the container size... You can view the image at the t ...

When a table has overflow set to auto, any content that exceeds its dimensions will

The issue at hand is explained in the fiddle provided. The problem arises when there is a scrollable table with a context menu inside it, and with the overflow-x: auto property set, the visibility of this "context menu" is hindered. table { overflo ...

Lock the first row and a few lines in place for an HTML table

I'm facing a layout challenge on my webpage. I have a header line followed by a table, and I want both the header line and the top row of the table to be frozen while allowing the rest of the table to scroll. Despite trying to use 'position:fixed ...

Toggle the visibility of the search Div using Angular UI

When using angular UI buttons, users can select search criteria by choosing between Patient, ID, or Date. If Patient or ID is selected, the searchByText div will be shown. If Date is selected, the searchByText will be hidden and the SearchBydateRange wil ...

A horizontal line will separate the title both before and after

Is there a way to create an hr line both before and after a title using Bootstrap 5? I have managed to add the lines, but I am struggling to align the title within a container class in order for the lines to span the width of the screen. My current code s ...

The current code lacks any form of line breaks

While attempting to edit a CSS file in Sublime Text 2, I noticed that all the code is displayed without any line breaks. This makes it difficult to read and work with. Is there a way to fix this issue and format the code into readable sections? ...

"Encountering issue with SCSS variable not being applied to background in file

$enable-grid-classes: false; $enable-cssgrid:true; $deepBlue: #032f3e; body { --bs-body-bg: orange ; } @import "https://fonts.googleapis.com/css2?family=Space+Grotesk:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="463121 ...

Issues surrounding horizontal scrolling using CSS and HTML

Recently, I've been honing my coding skills by creating websites using HTML and CSS. I came up with an interesting concept for a horizontal scrolling menu. You know the type I'm talking about - where clicking on one item jumps to another in a cyc ...

Uploading files with previews and no option to alter the image dimensions

I am having trouble with resizing an image preview before submitting it. Despite setting the width and height to 1px in both the div and image, it still displays at its normal dimensions. $(function() { var imagesPreview = function(input, placeToIns ...

Failure of Highchart's resizing mechanism when hidden

Check out this AngularJS demo app featuring Highcharts: http://jsfiddle.net/dennismadsen/dpw8b8vv/1/ <div ng-app="myapp"> <div ng-controller="myctrl"> <button ng-click="hideView()">1. Hide</button> <button ng ...

The secrets of z-index: Ensuring nested elements stay behind their parent element

Check out this demo to see the problem: http://jsfiddle.net/5sqxQ/2/ I am trying to make the sub menu appear below the main menu. I also want to use JavaScript to slide the menu from underneath when hovering over the parent li element. I don't real ...

What is the best way to collapse additional submenus and perform a search within a menu?

Whenever a sub-menu is activated, only the current sub-menu should be open while the others remain closed. I need the search function to be enabled on the text box and display all items containing the specified value while also changing the color of <a ...

Difficulty with setting a border for text spanning multiple lines

I am trying to style a header text with a border around it. The issue arises when the larger text spans over two lines, causing the border to break in between. In an attempt to fix this, I applied the CSS property box-decoration-break: clone;. However, thi ...

The Boostrap filter table control seems to be malfunctioning despite using the CDN on ASP.NET CORE MVC

How can I implement column filtering in a table using Bootstrap? Here is the code I have tried: <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.18.3/extensions/filter-control ...

The functionality of AngularJS ng-click is disrupted by the presence of {{$index}}

Having an issue with AngularJS where using $index breaks the ng-click function. This issue arises within a div utilizing ng-repeat, the repeat code is functioning correctly... <a class="accordion-toggle" data-toggle="collapse" data-parent="#acc{{$inde ...

JavaScript button for displaying and hiding all content in one click

I came across a tutorial on W3Schools that showed how to create collapsibles, and I thought it would be great to have buttons that could expand or collapse all at once. I've been trying to implement this feature using the code provided in the tutorial ...

The font styles in IE are failing to render properly following the disabling of caching in Node JS

Why are the CSS fonts not working in Internet Explorer after disabling cache in Node JS? After a user navigates to a page and then clicks the back button to return to the previous page, the font styles are not rendered properly in IE 11. The code 'k ...

The optimal method for selecting a button from a group of buttons on a calculator using pure JavaScript

I have developed an HTML/CSS code inspired by the Mac/Apple calculator design. It features buttons organized in 5 rows using flexbox. You can view my code on this codepen: <div class="wrapper"> <div class="calheader"> ...