Cracking the Code of Twitter Bootstrap's Scaffolding and Grid System

Currently utilizing Bootstrap for my project and encountering a peculiar layout issue within my fixed (non-responsive) design.

Using the BS scaffolding syntax, I have multiple nested divs in my grid. Typically, everything appears and functions correctly; however, intermittently upon page reload, the divs break throughout various sections of the page (header nav, main content divs, etc.)

I am unable to replicate this problem consistently, as it seems to occur randomly when I refresh/reload the page.


Provided below are screenshots illustrating the problem occurrence and how it should consistently appear:

good 1

bad 1

(Additional URLs can be requested by substituting "3487/ss-2-good.jpg" & "3484/ss-2-bad.jpg")


Steps taken but no successful outcome achieved:

- revising the grid

- meticulously reviewing my custom CSS line by line to identify potential triggers

- verifying paths, file order within webpage structure, etc.

- repeated searches for solutions


Outlined below is the basic HTML structure:

   <div class="container"> 

<?php require ("includes/nav-top.php") ;?>
  <!--page header -->
  <div class="row" id="">
    <div class="span6">
         ... content ...
    </div>
    <div class="span6">
        ... content ...
    </div>
  </div>
  <div class="row">
       ... content ...
  </div>
  <div class="row-fluid">
    <div class="span8">
      <div class="span6">
          ... content ...
      </div>


      <div class="span6">
          ... content ...
      </div>


      <div class="row-fluid">
        <div class="span6">
            ... content ...
        </div>
        <div class="span6">
            ... content ...
        </div>
      </div>
      <!--row-fluid--> 

    </div>
    <!--span8-->

    <div class="span4">
       ... content ...
    </div>
    <!--span4--> 

  </div>
  <!--row-->

  <div id="" class="row">
    <div class="span4">
        ... content ...
    </div>
    <div class="span4">
      ... content ...
    </div>
    <div class="span4">
     ... content ...
    </div>
  </div>
  <!--row-->

  <footer>
   ... content ...
  </footer>
</div>
<!--container-->

External files loaded as follows:

In HEAD section:

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
;
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>

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

<link rel="stylesheet" href="css/bootstrap-config.css">
<link rel="stylesheet" href="css/font-awesome.css">
<script src="js/vendor/modernizr-2.6.1-respond-1.1.0.min.js"></script>

Prior to closing BODY tag:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js"></script> 
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.2.js"><\/script>')</script> 
<script src="js/vendor/bootstrap.min.js"></script>
<?php require('includes/i-modal.php');?>
<?php require('includes/i-googleAnalytics.php');?>
<?php require_once('includes/i-js.php'); ?>

NOTES:

- Random occurrence of layout issues persist even after multiple attempts, followed by sporadic periods of correct display

- Includes such as Fancybox (i-modal.php) and custom JS (i-js.php) contain no apparent triggers for this behavior

- Currently, bootstrap-config.css remains empty; adding any content triggers the problem, irrespective of margin or padding settings

- After research, it seems that using "row-fluid" for nested grid sections is permissible within the fixed layout setup

- Problem noticed primarily on Safari / OSX; other browsers do not consistently exhibit the issue, but it remains unpredictable


Considering all observations, seeking insights from experienced individuals regarding these symptoms. While Bootstrap proves invaluable, has anyone encountered similar challenges?

Appreciate your attention to this matter.

Answer №1

Initially, there are some issues with the layout structure that you need to address. It should be formatted in the following manner:

  <div class="row" id="">
    <div class="span6">
      <div class="row">
        <div class="span3">
         ... content ...
        </div>
        <div class="span3">
         ... content ...
        </div>
      </div>
    </div>
    <div class="span6">
        ... content ...
    </div>
  </div>
  <div class="row">
     <div class="span12">
       ... content ...
     </div>
  </div>
  <div class="row-fluid">
    <div class="span8">
      <div class="row-fluid">
        <div class="span6">
            ... content ...
        </div>
        <div class="span6">
            ... content ...
        </div>
      </div>
    </div>
  </div>

In order to rectify these issues, make sure to adhere to the following guidelines:

  • Avoid using row-fluid in fixed layouts.
  • The full width span should be set at 12 units.
  • All content must be placed within spans - without exception.
  • Sub-spans must always be enclosed in rows.
  • The total number of spans within a sub-row should match the container span (excluding row-fluid instances). For example, within span8, you can include a row comprising of span6 and span2.
  • If unsure, refrain from making changes to Bootstrap CSS.
  • Ensure that no custom CSS classes unintentionally share names with those in Bootstrap.

By addressing these issues, you should be able to resolve any display problems present on your website.

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

CSS: Have you ever wondered why :not() doesn't work unless you specify the tag type?

Here's the code I'm working with: * { font-size: 30px; } .day { color: gray; } .today { color: blue; } :not(.today) .date { color: orange; } <span class="day">Tuesday<span class="date"> • 4</span></span> &l ...

Hyperlinks will not function properly within paragraph tags

It seems that my href links stopped working while in p tags. They work fine when I put them in H3 tags, but then the layout and style sheet formatting get messed up. I'm starting to wonder if this issue is related to the site's CSS or XHTML. Cod ...

Start playing the video as soon as the modal pops up, and pause it when the

When you click on the image, a video opens up in a modal dialog and you have to manually press play. If you click off the video, it will keep playing unless it has been paused or finished. If I enable autoplay for the video, it starts playing as soon as t ...

Fixing the distortion of various skewed images at both ends

Earlier, I inquired about skewing a collection of images and was pleased with the results. https://i.sstatic.net/Skquv.png .container { font-size: 0; height: 215px; margin: 30px 50px; text-align: center; color: black; ...

The Jquery Function is designed to execute each time the trigger is clicked, however, it is not functioning as

My lovely little website has a charming div that hides any content overflowing the wrapper. I'm trying to adjust the margin-top by $value-120px every time a span with the class of .maisfilme is clicked. Here's my current code: $(document).ready ...

Switch the dropdown menu to a button if it consists of only one option

I have been using a database within the Moodle Learning Management System that generates a bootstrap table. Here is an example of what it looks like: https://i.sstatic.net/UJc4M.png The last row in the table contains a dropdown menu. When viewing your ow ...

Is there a way to prevent this from moving and have it only load below?

Is there a way to prevent an input box from altering the size of an HTML <li> element when it is revealed beneath item 2? Additionally, how can one ensure that the input box opens directly below item 2 without affecting the layout? Lastly, what adj ...

Discovering whether a pseudo-element (::after) has been clicked in a React.js environment

I'm attempting to capture click events on an element's ::after pseudo element. I hope that something along these lines is achievable: //css div:after{ content:"X"; display:block; } //jsx class PsudoExample extends Component { render() { ...

Position Element on Top of Input Field

I'm struggling to position the Avatar element over my TextInput to create a traditional search bar appearance. However, the icon isn't overlapping the TextInput. Could you please explain why it's not working or suggest a more effective way t ...

The CSS styles do not seem to be taking effect on the Bootstrap

Here's a snippet of code extracted from my website's html and css files. My intention is to make the navbar slightly transparent with centered links, but for some reason, the css styles are not applying correctly to the navbar. HTML <body ...

Ways to showcase information on websites using Myanmar/Burmese typeface

I manage a website catering to the Burmese community, with content in the Burmese language. However, I have encountered an issue where the text appears broken due to using Zawgyi format instead of Unicode format in Myanmar. How can I resolve this problem? ...

Numerous items lined up in a single row

I have designed a skills section that includes a name and corresponding image. Now, I would like to pass the skill's name into a child component. My goal is to display three of these skills on the same row, but using ngFor currently results in each sk ...

Issues with the CSS of sub-items have been identified on the jQuery toggle menu

After a disappointing experience with a developer missing deadlines, we decided to finish the website on our own. We only have a few tasks left, one of which is fixing a JQuery based navigation toggle that isn't displaying the correct CSS for sub menu ...

Organize Grid items in a column using Material UI and React

Seeking assistance with adjusting the positioning of my Grid Items in Material UI. Progress so far can be found on Codesandbox. The issue at hand is how to align items 2 & 3 to the right of item 1. I've made some progress but struggling with str ...

Managing CSS classes in Vue js - Best practices

My challenge is to dynamically add and remove classes in response to input validation using the textfield component from Google Material. If the text input fails validation, I need to display a red border around the input field along with a warning message ...

`On mobile devices, the Bootstrap button no longer displays focus changes once clicked.`

When clicking a primary bootstrap button, it changes its background color to blue on mobile devices. https://i.sstatic.net/VNPDP.jpg For example, the first button appears normal and the second one turns blue after clicking. However, this background effec ...

How can you center the body of a webpage while using the zoom in and zoom out features in HTML5?

What is the best way to maintain body alignment while zooming in and out on a web page? <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> body { font-family: 'Merriweather Sans&apos ...

The Bootstrap Carousel is glitching and cannot be customized using HTML and CSS - I even included a demonstration gif

incorrect output: https://i.sstatic.net/6kwqT.gif When observing closely as the carousel transitions from almond 2 to almond 3, there is a slight jump that occurs. Despite multiple attempts, I have been unable to eliminate it. To demonstrate the issue, I ...

Is there a way to input text so that it remains hidden from view but is still accessible by the clipboard?

For some time, I had utilized style=display:none on an image along with its alt text. However, this approach is no longer effective. What alternative solutions are available? ...

A guide on using JSON data fetched with Javascript to apply CSS styling

I'm currently working on an HTML document with dynamic content that needs to adjust its styling based on data from Google Sheets. I've successfully loaded the JSON data, but I'm struggling to figure out how to dynamically change the CSS. Can ...