Tips for utilizing bootstrap.css to position a web design form in the center of the page and place the copyright at the bottom

I have spent several hours trying to figure out how to achieve this, but still haven't found the solution.

I have a form that I believe doesn't look very good:

https://i.sstatic.net/t1MRd.png

So, I attempted to center the form on the page and place the footer.php at the bottom-center.

form.php

<div class="row">
          <div class="col-xs-12 col-sm-6 col-md-6">
          <div class="well">
            <div class="page-header">
              <h3>Add Preference Value</h3>
            </div>

                <form method="post">
                  <div class="form-group">
                    <label for="kt">Value Description</label>
                    <input type="text" class="form-control" id="kt" name="kt" required>
                  </div>
                  <div class="form-group">
                    <label for="jm">Value Amount</label>
                    <input type="text" class="form-control" id="jm" name="jm" required>
                  </div>
                  <button type="submit" class="btn btn-primary">Save</button>
                  <button type="button" onclick="location.href='nilai.php'" class="btn btn-success">Go Back</button>
                </form>

          </div>
          </div>
          <div class="col-xs-12 col-sm-3 col-md-3">
        </div>
        </div>
        <?php
include_once 'footer.php';
?>

footer.php

<footer class="text-center">&copy; 2017</footer>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-1.11.3.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.dataTables.min.js"></script>
    <script src="js/dataTables.bootstrap.min.js"></script>
    <script>
        $(document).ready(function() {

            $('#tabeldata').DataTable();

        });
    </script>
  </body>
</html>

I also discovered some classes in bootstrap.css, which are:

.well {
  min-height: 20px;
  padding: 19px;
  margin-bottom: 20px;
  background-color: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
.well blockquote {
  border-color: #ddd;
  border-color: rgba(0, 0, 0, 0.15);
}
.well-lg {
  padding: 24px;
  border-radius: 5px;
}
.well-sm {
  padding: 9px;
  border-radius: 2px;
}
.text-center {
  text-align: center;
}

Answer №1

To adjust your starting point, you can use an offset. Like so:

<div class="col-xs-6 col-xs-offset-3">

Check out the demo

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<div class="row">
  <div class="col-xs-6 col-xs-offset-3">
    <div class="well">
      <div class="page-header">
        <h3>Add Preference Value</h3>
      </div>

      <form method="post">
        <div class="form-group">
          <label for="kt">Value Description</label>
          <input type="text" class="form-control" id="kt" name="kt" required>
        </div>
        <div class="form-group">
          <label for="jm">Value Amount</label>
          <input type="text" class="form-control" id="jm" name="jm" required>
        </div>
        <button type="submit" class="btn btn-primary">Save</button>
        <button type="button" onclick="location.href='value.php'" class="btn btn-success">Go Back</button>
      </form>
    </div>
  </div>
</div>

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

Issue with JQuery's parentsUntil method when using an element as a variable not producing the desired results

I'm having trouble with a specific coding issue that can be best illustrated through examples: For example, this code snippet works as expected: $(startContainer).parents().each(function(index, parentNode) { if (parentNode.isSameNode(commonConta ...

How do you center controls within a repeater control's item template?

I have a repeating control on my page that displays an image and a hyperlink one below the other. When I add more than one line of text, it causes the image to move up. I want the top of the images to be aligned horizontally and the text to flow downward i ...

Aligning a div with absolute positioning vertically

There are two elements positioned side by side: an input field and a div. The div is absolutely positioned inside a relative element and placed to the right of the input. The input field has a fixed height, while the height of the div depends on its conte ...

What is the best way to enlarge the text in an image input field?

One of the input fields I'm working with looks like this: <input type="image" name="submit" value="submit" src="images/searchb1.png" id="button1"/> I am trying to figure out how to enlarge the text Submit on that field using CSS. Any suggestio ...

Create automatic transcripts for videos, including subtitles and captions

Are there any tools or plugins available that can automatically create a transcript of a video for website playback? For example, generating captions and subtitles in the English language. ...

What is the best way to display an image in HTML?

I have successfully created an autocomplete search box that retrieves product names, but I am struggling to display the product photos. Here is the code snippet I am using: <asp:TextBox ID="txtContactsSearch" runat="server" Width="261"></asp:Text ...

Using Masonry with AngularJS templates: A step-by-step guide

Hey there! I'm trying to incorporate masonry into my AngularJS project. I'd like the divs to flow from left to right within their container. The documentation suggests using the following code: <div class="js-masonry" data-masonry-options=&ap ...

Fixing issues with internal web page connections (#x) present in the HTML code (href="#x" id="x")

Can anyone come up with a brilliant solution as to why my internal links are not functioning properly on a webpage? I've coded the HTML with the usual <a href="#link"><button>Some Text</button></a> .... bunch of content .... & ...

How can I efficiently verify page references using tools like CSS, JavaScript, and more?

I have Firebug (my team lacks Firefox) and the IE developer toolbar (IE7), but I'm struggling to easily validate if the referenced files in a page are loading. I see Javascript errors, but they don't lead me directly to the exact file in the hier ...

Tips for designing a tilted CSS layout from scratch

I am looking to design a stylish interface using HTML & CSS. Here is the style I want to achieve: Currently, my interface looks like this: Although these are just reference images, you can see that my design does not have the same sleekness as the one in ...

The Fixed Navbar is causing sections to be slightly off from their intended positions

Utilizing a bootstrap navigation menu on my website with a fixed position. When clicking a menu item, it takes me to the designated section but slightly above the desired position. How can I ensure that it goes to the exact position upon clicking the men ...

What is the best method for seamlessly loading JSON data while transitioning between pages in a jqtouch application?

I've been working with JQTouch for my application. While the demos showed how to retrieve an html file and display it in the user interface, I'm dealing with loading JSON data that I want to incorporate into an existing DIV element. I prefer not ...

The error message "Angular formGroup requires a FormGroup instance. Kindly provide one."

I used angular reactiveforms to create a form. The default data is successfully printed on the form, however, I am facing an error in the console that says "formGroup expects a FormGroup instance. Please pass one in." Can someone guide me on how to resolve ...

Navigate through content to reach the bottom of the webpage

I am currently working on a layout that is similar to Facebook's messaging system (facebook.com/messages). I have made some progress with it, but not quite there yet. You can view my work so far here: https://jsfiddle.net/3nd0b17m/23/ The main issue ...

Accessing a specific column through Jquery Ajax is causing it to return as Undefined

Looking for ASP.NET Help I am currently struggling with converting a DataTable to an array in ASP.NET. If there is a simpler way to achieve this or if I can send the DataTable as JSON easily, please provide me with guidance. Currently, I have been using th ...

Bring in an SVG element from a separate document while retaining the CSS <style> details from the original source

Creating a number of SVG files can be made easier by keeping common symbols in one file and importing them into others. An effective method for achieving this is using the <use> element: <use href="common.svg#symbol1" /> However, th ...

"Utilizing margins to create space between elements within a Bootstrap

I am currently utilizing bootstrap 4 and have a list of items that I am displaying in the following manner: <div class="container"> <div class="row"> <div class="card col-md-4 col-sm-6 col-12 item-wr" *ngFor="let item of items"> ...

strange glitch found in jquery ui resizable

Experimenting with jquery UI, I came across an unusual bug. After clicking a button to make a div resizable, the div unexpectedly moves below the button. resizable.html: <html> <head> <link href="my.css" rel="stylesheet" type=" ...

Explore the comparison feature with jQuery's combobox

I am attempting to compare values from an array with values in a combobox using jQuery, but I am encountering difficulties. My array is structured like this: (value 1, value 2,...) names separated by commas (Example: john smith, peter pan). On the other h ...

Achieve vertical center alignment of items using flexbox styling

I'm attempting to vertically center elements using CSS flexbox. I have successfully implemented it with the non-vendor-prefixed code, but I am facing issues in Webkit (Chrome) even with the vendor prefixes. My goal is to vertically align the spans wi ...