Placing a button at the bottom of a bootstrap well

Hey there, I'm facing an issue with the button positioning. I really need the button to be placed at the bottom of the well, but for some reason, it keeps showing up next to the image instead.

This is what's happening: the button is ending up beside the image, but I want it to be at the bottom of the well. https://i.sstatic.net/Z7Xy8.png

Below are the code snippets that I've been working with:

<div class="container">
<h2 class="center">CTTS Data</h2>
  <div class="row">
  <div class="col-md-12 col-sm-12" id="CTTSData">

    <script>
    $.ajax({
      url : "CR_Data/CTTS_Data.json",
      type : "post", 
      contentType:"application/json", 
      success : function(list){           
          var divCol  = "<div class='col-sm-4 col-md-4'>";
          var divWell = "<div class='well' style='position:relative'>";
          var divClose = "</div>";

          console.log(list);

            list.forEach(function(obj, index) {

            //console.log(obj); 

            var title     = "<h5>"      + obj.title    + "</h5>";
            var linkStart = "<a href='" + obj.imagePath + "' target='_blank'>" ;
            var image     = "<img class='thumbnailSmall' data-toggle='tooltip' data-placement='left' title='Click to open data' src='" 
                                + obj.imagePath + "' height='100%' width='100%'/>"
            var linkEnd   = "</a>";
            var linkFile  = "<a class='btn btn-danger' id='btnView' href='" + obj.filePath + "'>Open File</a>";

            var div = divCol    +
                      divWell     +
                      title       +
                      linkStart       +
                      image       +
                      linkEnd +
                      linkFile +
                      divClose +
                      divClose;

           $("#CTTSData").append(div); // inserting the newly created div

           })
        }
    });
  </script>


  </div>
  </div>

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

CSS:

#btnView{
position: absolute;
margin-bottom:   20px;
}

Answer №1

One way to enhance the design of your button is by incorporating it within a bootstrap "row" container:

var divCol  = "<div class='col-sm-4 col-md-4'>";
var divWell = "<div class='well'>";
var divClose = "</div>";

var title     = "<h5> title </h5>";
var linkStart = "<a href='#' target='_blank'>" ;
var image     = "<img class='thumbnailSmall' data-toggle='tooltip' data-placement='left' title='Click to open data' src='path' height='100%' width='100%'/>"
var linkEnd   = "</a>";
var linkFile  = "<div class='row'><a class='btn btn-danger' id='btnView' href='#'>Open File</a></div>";

var div = divCol + divWell + title + linkStart + image + linkEnd + linkFile + divClose + divClose;

$("#CTTSData").append(div); // insert the div you've just created
#btnView{
  margin-top: 20px;
  margin-left: 15px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
  <h2 class="center">CTTS Data</h2>
  <div class="row">
    <div class="col-md-12 col-sm-12" id="CTTSData">
    </div>
  </div>
</div>
<!-- /.container -->

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 dynamically display CSS code from a PHP variable without needing to refresh the

I am working on a page that utilizes ajax and PHP for all functions. Within the tab content, users have the option to select colors using color pickers. Once a user saves their chosen colors, I store the new CSS code in the database. The CSS code is as ...

What is the best way to position images and URLs in div elements using CSS?

Currently, I am on a journey to become a Front End Developer through Udacity. As part of my learning process, I have a project that needs to be submitted. Unfortunately, I encountered some issues that I couldn't resolve on my own. Specifically, I&apos ...

Utilize Flexbox to position a group of items in the center of the page, while placing a single item at the bottom for added emphasis

I have utilized Bootstrap 4 along with some custom CSS to create a hero section where all items are centered both horizontally and vertically. The only exception is one item that I want to align at the bottom of the page while still keeping it centered ho ...

What is the best way to ensure that my grid remains contained within its designated area?

I need to incorporate a grid of 16x16 or 64x64 into my layout without it overflowing. I'm considering using flexbox, but unsure of the implementation process. My goal is to have the grid resize based on the container size rather than exceeding its bou ...

Unable to render Angular charts

Recently, I've been attempting to integrate angular charts using the chart.js bundle sourced from CDN links. The version of Angular being used is 1.5.7 and for chart.js it's 2.1.6. I encountered the following error message: angular.js:13708 T ...

Altering the color of a Fabulous Icon in real-time

I'm having trouble changing the color of an Awesome Icon with this code I created. Instead of getting the desired color, I am getting 'undefined' as a result. <script type="text/javascript"> function changeAIColor(idName) { alert ...

Issue with Internet Explorer 7: Floating elements are incorrectly positioned below their intended placement

Upon visiting using IE7, you may notice that the two middle columns are being pushed down to the bottom of the page. I have attempted to resolve this issue by applying display:inline to both columns without success. Any assistance on this matter would be ...

Prevent unauthorized entry to css and javascript files

Is there a way to prevent direct access to a file? I want the file to be used on my website, but I want to block it from being accessed directly. For example, if you try to open this link: https://example.com/style.css, you will see an error message. Howev ...

What are the steps to create a dynamic navigation bar in React without encountering hydration issues?

My goal is to dynamically show or hide links based on user authorization. Here's my initial approach: const Navbar = () => { const { canDo, ...} = useUser(); //A Zustand store return ( <> <div> <ul> ...

Can the text color be customized to match the brightness level of the background area being covered?

Does anyone know of a plugin or method that can automatically change the color of text or swap predefined images/icons based on the average brightness of its parent element's background? If the background is dark, it should make the text white or swit ...

Persistently Undefined Angular Attribute

I have been trying to dynamically bind a CSS class using an AngularJS function. While the functionality is working properly, I keep encountering numerous errors in the browser console. Can anyone offer assistance with this issue? I have included my code an ...

Conceal and reveal buttons at the same location on an HTML webpage

There are 3 buttons on my custom page called page.php: <input type="submit" value="Btn 1" id="btn1"> <input type="submit" value="Btn 2" id="btn2" onClick="action();> <input type="submit" value="Btn 3" id="btn3" onClick="action();> ...

A guide on customizing the appearance of individual items in a vue v-for loop based on specific conditions

I am currently developing a multiple choice quiz game and I want the selected answer by the user to change color, either red or green, depending on its correctness. To achieve this, I have created a variable called selected that correctly updates when the ...

Instructions on integrating iframe into Slides on material-auto-rotating-carousel

Looking to swap out the carousel slide image with a loom video. Any ideas on how to replace the media img with an iframe in material-auto-rotating-carousel? const AutoRotatingCarouselModal = ({ handleOpen, setHandleOpen, isMobile }) => { return ( ...

Animation of two divs stacked on top of each other

I am trying to replicate the animation seen on this website . I have two divs stacked on top of each other and I've written the following jQuery code: $('div.unternehmen-ahover').hover( function () { $('div.unternehmen-ahover' ...

unable to apply custom css to primefaces components

In my Java EE application, I am using a ready-made template with CSS and jQuery. All the PrimeFaces components are rendering properly except for the panelGrid control of PrimeFaces 3.2. It is being displayed with a border, but I want it without a border. I ...

Angularjs still facing the routing issue with the hashtag symbol '#' in the URL

I have recently made changes to my index.html file and updated $locationProvider in my app.js. After clicking on the button, I noticed that it correctly routes me to localhost:20498/register. However, when manually entering this URL, I still encounter a 4 ...

Having trouble with a dropdown menu that allows for multi-select options?

var expanded = false; function showCheckboxes() { var checkboxes = document.getElementById("checkboxes"); if (!expanded) { checkboxes.style.display = "block"; expanded = true; } else { checkboxes.style.display = "none"; expanded = fa ...

Using conditional statements like 'if' and 'else' in JavaScript can

Can someone help me with solving my problem using if-else statements in Javascript? I need to filter names by gender and save them as keys - woman / man in local storage. Any assistance would be greatly appreciated. I am struggling to figure out how to im ...

Obtain the length of a sound file in .wav format

Can anyone suggest a way to incorporate a waveform or horizontal bar on a website that displays the duration of a WAV file in seconds using HTML text? For instance, for a 60-second WAV file: I'm open to any ideas. ...