Exploring Bootstrap: Understanding column stacking and the requirement for a new row to stack upon resizing

I am currently mastering Angular and Bootstrap for a potential job opportunity, so I have decided to create a simple demo page. However, I am facing an issue with getting a new row to stack after the last div of the previous row when resizing. Initially, my page layout looks like this:

Picture|Text|Btn|Btn <- Row 1
[  hidden div      ]
|   12 point col   | <- Row 2

When I resize the page, the elements end up stacking like this:

Picture
|Text12 p col|
Btn
Btn

The desired outcome is for the elements to stack as follows:

Picture
Text
Btn
Btn
|12 pt col|

Kindly review the code below. I believe there might be a fundamental concept that I am missing. The type of column is not crucial; I just want the stacking behavior to function correctly.

<div class="container-fluid" id="mainFrame" ng-controller="mainController">
      <div class="row" id="row1">
        <div class="col-sm-2">
          <img src="img/blah.jpg">
        </div>
        <div class="col-sm-4" id="nameplate">
          <p>Lorem Ipsum</p>
          <p>sit amet dolor</p>
          </br>
          <p>Demo Page</p>
          <p>Frameworks: Angular and Bootstrap</p>
        </div>
        <div class="col-sm-3"><div class="btn" id="bluebtn"><p>Push Me!</p></div></div>
        <div class="col-sm-3"><div class="btn" id="redbtn"><p>Push Me!</p></div></div>
      </div>

<!-----------------Top of hidden row-------------------------->
<div class="jumbotron container-fluid" ng-show="false"></div>

<!-----------------Top of row 3-------------------------->


<div class="col-sm-12"><p>Test</p><p>Blah</p><p>Blah</p></div>


</div>

Below is the CSS I am using:

img
{
    height:30vh;
    padding:1vh 1vw;
    position:relative;
    top:8vh;

}


div
{
    border: 1px solid black;
}

.row div
{
    height:100%;

}

.row div div
{
    height:30px;
}

#nameplate
{
    vertical-align: bottom;
    margin: auto;
    text-align:center;

}

#nameplate p
{
    margin:2vh 2vw;

}

#mainFrame
{
    height: 100%;

}

Any assistance or suggestions would be greatly appreciated! Thank you.

Answer №1

To achieve responsiveness, it is necessary to specify different column sizes for various screen sizes in your code. Below is a snippet demonstrating this concept:

<!DOCTYPE>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Secure Login: Protected Page</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
          <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
          
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
          <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
          </head>
          <body>

<div class="container-fluid" id="mainFrame" ng-controller="mainController">
      <div class="row" id="row1">
        <div class="col-sm-2 col-md-2 col-lg-2 ">
          <img src="img/blah.jpg">
        </div>
        <div class="col-sm-4 col-md-4 col-lg-4" id="nameplate">
          <p>Lorem Ipsum</p>
          <p>sit amet dolor</p>
    
          <p>Demo Page</p>
          <p>Frameworks: Angular and Bootstrap</p>
        </div>
        <div class="col-sm-3 col-md-3 col-lg-3"><div class="btn" id="bluebtn"><p>Push Me!</p></div></div>
        <div class="col-sm-3 col-md-3 col-lg-3"><div class="btn" id="redbtn"><p>Push Me!</p></div></div>
      </div>

<!---Top of hidden row-->
<div class="jumbotron container-fluid" ng-show="false"></div>

<!---Top of row 3-->


<div class="col-sm-12 col-md-12 col-lg-12"><p>Test</p><p>Blah</p><p>Blah</p></div>


</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

What is the best way to transfer a table with multiple rows in a single column to an Excel spreadsheet while maintaining the headers on a horizontal plane

Currently, I am in the process of gathering data. The data is being sent to me in a word format and organized in a vertical columned table with different headers and alternating data. I am looking for a way to export this data from Word into an Excel spre ...

"By selecting the image, you can initiate the submission of the form

I am trying to figure out why clicking on the image in my form is triggering the form submission by default. Can someone please provide guidance on this issue? <form name="test1" action="er" method="post" onsubmit="return validateForm()" <input ty ...

Exploring the process of sending a post data array from Angular to retrieve data on a Laravel API platform

I am working on an Angular project and I have the following code with an array: myArray: [{"kode":"123","nama":"satu dua tiga"},{"kode":"321","nama":"tiga dua satu"}] Now, I need to send this data using a POST request: $http({ method: 'POST&ap ...

The background positioning feature is experiencing some technical issues

Using Jekyll, I have code where the inline background-position changes based on the front-matter position I define: * { box-sizing: border-box; } body{ padding: 0; margin: 0; } .page__hero--overlay { position: relative; margin-bottom: 2em; ...

Guiding user to their destination after signing in

Having trouble showing different headers based on user login status? Users can log in using login.php, but you're struggling to display header.php when a user is not logged in or logged in. You want the page to show profile form content when they are ...

How can CSS positioning be utilized to align lines accurately?

Recently, I created a basic jsbin to draw a line connecting two points. It doesn't rely on any drawing libraries; just plain JavaScript and jQuery. I managed to calculate the angle using code I found in this library. When dragging the circle at the ...

Click on the "bootstrap" tab to access an external website

Greetings, I find myself in this particular situation, <ul id="myTab" class="nav nav-tabs" role="tablist"> <li class=""><a href="#Tab1" role="tab" data-toggle="tab">TAB1</a></li> <li class="active"><a href="# ...

When using AngularJS to compile HTML with $compile and $scope, an error may occur stating: "Unable to convert circular

I have a project that involves creating dynamic HTML and adding it to an object array. This HTML needs to be displayed on the page and be responsive to user interactions, such as clicking. Angular requires me to use $compile to create an angularized templa ...

Turn off slider trace animation?

Check out the slider component in MUI here: https://mui.com/material-ui/react-slider/ I'm currently exploring how to disable the animation on the nub so it moves instantly to the new position. Any advice on how to achieve this? ...

Easily updating a SQL row with the click of an HTML button using PHP

I am in the process of creating a basic comment system that includes a rating for each comment. After reading a comment, users will be asked if they liked it with two options, "Yes" and "No". I am seeking a straightforward method to update the number of ...

Using XSLT with JavaScript

I am currently working with a set of XML files that are linked to XSLT files for rendering as HTML on a web browser. Some of these XML files contain links that would typically trigger an AJAX call to fetch HTML and insert it into a specific DIV element on ...

Discover the ultimate guide to implement a captivating visual overlay using CSS

I've crafted some links using CSS to incorporate a background image (to give it the appearance of a button) employing the subsequent code: <a class="btnImg" id="btnImgConfig" href="#"></a> .btnImg { width:100px; height:100px; ...

jQuery functions not functioning properly when triggered by an event

I encountered an issue with my page using jQuery and Bootstrap. Everything was functioning properly until I tried calling a function on an event, which resulted in the console showing an error message saying $(...).function is not a function. For example: ...

Execute a sudo command using an html button

Looking for a way to create a simple website with HTML buttons on my Raspberry Pi that can execute sudo commands. I attempted the following method: <?php if (isset($_POST['button'])) { exec('sudo reboot'); } ?> ...

What is the best way to display the loan detail and credit detail tables beneath the application detail section that is currently blank?

I have a total of four tables on my page. The size of one table is almost identical to the other three smaller tables. I am looking to place the loan details and credit details table below the application detail, in a way that utilizes the empty space avai ...

"Troubleshooting the issue of Angular UI-Select failing to display a large

Check out my comprehensive json file containing cities from around the world: download here. Furthermore, take a look at the snippet of html code below: <div class="form-group"> <label class="control-label"> CITY </label> ...

What is the method to retrieve the base host in AngularJS?

I need assistance with the following URL: https://192.168.0.10/users/#!/user-profile/20 When I use $location.host, it returns 192.168.0.10 However, I only want to extract https://192.168.0.10 What is the best way to achieve this? ...

Tips for showcasing a personalized design using ng-repeat

Upon reflection, I realized that my original question needed improvement, so here is the revised version. Hello! I am new to Angular and I am attempting to create a custom layout for my data list using ng-repeat. I want to display different model values w ...

Custom directive with nested objects within a scope object

What is preventing me from having a binding in a nested object within my scope object, as demonstrated here: app.directive('myDirective', function() { return { scope: { dropdown: { option: '=selectedO ...

AngularJS ng-click function not saving correct order of Sortable list in jQuery UI

I have created a sortable jQuery UI list and I am facing an issue with sending the sorted data back to the server. Despite receiving the correct sort order when using console.log on sortAreasEV, the data sent back to the server is in the original order. B ...