Adjust dimensions of petite structures on expansive sheets

I have a user profile form that is compact in size.

The issue is: the form/fields are small but the page itself is large. I don't want these fields to take up the entire page.

My solution is to make the fields even smaller.

The current layout allocates 2/12 of the space to the menu and 10/12 to the form.

One option is to place the form inside a smaller column, like 4/12 or 5/12. However, this poses a problem when the page is viewed on a smartphone as the form should then occupy the full page once again, like 10/12.

Location of the page:

Here is the code:

<div class="row">

        <div class="col-md-12">

          <div class="row">

            <div class="col-md-2">

              <ul class="list-group">
                <a href="#" class="list-group-item"><strong>Profile</strong></a>
                <a href="my-account-password.html" class="list-group-item">Password</a>
              </ul>

            </div> <!--/col-md-2-->

            <div class="col-md-10">

              <form>
                <div class="form-group">
                  <label for="inputName">Name:</label>
                  <input type="text" class="form-control" id="inputName" placeholder="Enter your name here" value="Wile E.">
                </div>
                <div class="form-group">
                  <label for="inputLastName">Last Name:</label>
                  <input type="text" class="form-control" id="inputLastName" placeholder="Enter your last name here" value="Coyote">
                </div>
                <div class="form-group">
                  <label for="inputTitle">Title:</label>
                  <input type="text" class="form-control" id="inputTitle" placeholder="Enter your title here" value="CEO">
                </div>
                <div class="form-group">
                  <label for="inputEmail">Email:</label>
                  <input type="email" class="form-control" id="inputEmail" placeholder="Enter your email here" value="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="26514f4a4f436647454b43454954560845494b">[email protected]</a>">
                </div>
                <div class="form-group bottom-buffer">
                  <label for="selectEmail">Notifications:</label>
                  <select class="form-control" id="selectEmailNotifications">
                    <option>None</option>
                    <option>Daily</option>
                    <option>Weekly</option>
                    <option selected>Monthly</option>
                  </select>
                  <p class="help-block">Receive email notifications with all the most important metrics of your business.</p>
                </div>
                <button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span>Save Changes</button>
              </form>

            </div> <!--/col-md-10-->

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

        </div><!--col-md-12-->

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

Answer №1

If you desire to adjust the size for smaller screens, you can utilize the col-xs (extra small devices and phones (<768px)) and col-sm (small devices and tablets (≥768px)) classes. Additionally, if you prefer your form not to take up the entire page width horizontally, you have the option to use the col-..-offset-.. class to add some margin around your form.

  <div class="row">

    <div class="col-md-12 col-sm-12 col-xs-12">

      <div class="row">

        <div class="col-md-2 col-sm-2 col-xs-2">

          <ul class="list-group">
            <a href="#" class="list-group-item"><strong>Profile</strong></a>
            <a href="my-account-password.html" class="list-group-item">Password</a>
          </ul>

        </div> <!--/col-md-2 col-sm-2 col-xs-2-->

        <div class="col-md-6 col-md-offset-2 col-sm-6 col-sm-offset-2 col-xs-6 col-xs-offset-2">

          <form>
            <div class="form-group">
              <label for="inputName">Name:</label>
              <input type="text" class="form-control" id="inputName" placeholder="Enter your name here" value="Wile E.">
            </div>
            <div class="form-group">
              <label for="inputLastName">Last Name:</label>
              <input type="text" class="form-control" id="inputLastName" placeholder="Enter your last name here" value="Coyote">
            </div>
            <div class="form-group">
              <label for="inputTitle">Title:</label>
              <input type="text" class="form-control" id="inputTitle" placeholder="Enter your title here" value="CEO">
            </div>
            <div class="form-group">
              <label for="inputEmail">Email:</label>
              <input type="email" class="form-control" id="inputEmail" placeholder="Enter your email here" value="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f3849a9f9a96b392909e96909c8183dd909c9e">[email protected]</a>">
            </div>
            <div class="form-group bottom-buffer">
              <label for="selectEmail">Notifications:</label>
              <select class="form-control" id="selectEmailNotifications">
                <option>None</option>
                <option>Daily</option>
                <option>Weekly</option>
                <option selected>Monthly</option>
              </select>
              <p class="help-block">Receive email notifications with all the most important metrics of your business.</p>
            </div>
            <button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span>Save Changes</button>
          </form>

        </div> <!--/col-md-6 col-md-offset-2 col-sm-6 col-sm-offset-2 col-xs-6 col-xs-offset-2-->

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

    </div><!--col-md-12 col-sm-12 col-xs-12-->

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

Answer №2

When utilizing the bootstrap Framework, you have the ability to customize the behavior of your col- div by using col-xs for mobile devices, col-sm for portrait tablets, and col-md for landscape tablets. Check out http://getbootstrap.com/css/#grid for more information.

If you find yourself restricted by the default settings, don't hesitate to expand the grid system by incorporating additional media queries tailored to specific screen sizes, such as xxl screens.

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

bootstrap-select option list limited by the length of the underlying component

Attempting to clearly illustrate an issue with a table containing data presented in a thymeleaf template. The table's header consists of a form used for filtering its contents. This problem arises only when the table has minimal content, such as just ...

The CSS code is functioning properly when implemented in a browser, but is not displaying correctly when added to the

When using the dev tools, we can easily apply border-radius: 20px; to .separate-containers .inside-article, .separate-containers .comments-area, .separate-containers .page-header, .separate-containers .paging-navigation, .one-container .site-content, .i ...

Align the inner container in the outer container-fluid

I'm struggling to center a container inside a container-fluid. Any suggestions on how to make it work? /* Setup Buttons Specific Styling */ .setup-bg { background: url("https://image.ibb.co/geAGqy/setupbtns_bg.png"); background-repeat: no-repea ...

Adjust the Subnav <li> element to take up 100% width and reposition the dropdown menu

My current challenge involves customizing a navigation bar using CSS. I am struggling with making the sub-menus expand to 100% width as they currently appear fixed in size. Additionally, I am trying to find a solution to display the submenu options on eith ...

What is the best way to place an icon in the lower right corner of a design

I have encountered an issue while building the testimonial section below. The problem arises when the amount of text in each block is not the same, causing the quote icon to be displayed improperly in the bottom right corner. Sometimes, it even extends out ...

Unresponsive HTML button

I'm currently developing an interactive text-based game that relies on button functionality to change text content. Everything was functioning perfectly until just a few moments ago, but now it has inexplicably stopped working. Here is the section of ...

Using Font Awesome Class Aliasing

Is there a way to create an alias for a Font Awesome class like fa fa-users, and then switch between classes dynamically? I'm working on a project where I need to use Font Awesome icons, and currently I have the following code: <i class="fa fa-us ...

Exiting the browser in the Intel XDK to switch back to the application

Currently working on a small app using Intel XDK. I have successfully implemented code to open an external browser window with the function below. However, I am now facing difficulties in trying to figure out how to close this browser window and return b ...

Is it possible to initiate validation on an HTML element without the presence of a form?

Is it possible to trigger validation on an HTML element without using a form? For example, I have set the required attribute on a field, but when I click the Save button, the field doesn't display the red outline indicating validation failure. I susp ...

"Create a dynamic HTML newsletter utilizing tables similar to the responsive design principles

Looking to create a mobile-responsive newsletter using my style.css <table cellpadding="0" cellspacing="0" border="0" align="center" width="600" bgcolor="#fff"> <tbody> <tr> <td style="padding-bottom:5px" valign="top"&g ...

From MySQL to Dropdown and Beyond

Embarking on this programming endeavor is new for me and I've hit a snag. Despite my efforts to find solutions, I haven't come across a satisfactory answer. So, here's the issue at hand: My goal is to retrieve data from a database and popula ...

Struggling to fix errors within a nested div element?

I'm currently utilizing AngularJS to perform basic form validation. Below is the current code snippet: <form name="myForm" id="form_id" method="post" novalidate> <div class="form-group"> <label for="myField_input" class="c ...

Ensure child images in a flex row are adjusted to have a height equivalent to 100% of the surrounding content

Consider this example: .row { background: #F88; margin-top: 20px; } .cont { display: block; height: 82px; width: 82px; background-color: #0AF; } .txt { background-color: #0C0; } <link href="https://stackpath.bootstrapcdn.com/bootstr ...

Achieving a Collapsible Top Navigation with Additional Selection in Bootstrap 4

Adding a new section above the current <nav>. This is what I hope will occur. https://i.sstatic.net/HBaYN.png Below is my code: https://jsfiddle.net/rLc588mu/ Appreciate your assistance! ...

Eliminating null values from arrays

Hello there! I'm currently working on inserting a list of locations into my database. $locations = array(); $locations = $_POST['loc']; $loc = implode(", ", $locations); However, when I insert the array into my database, the empt ...

Positioning an image alongside a row in a table

Looking to incorporate images alongside each row in a table using Html and CSS, similar to the example image below: https://i.sstatic.net/fASNr.png The desired placement for the images is depicted by the red crosses: positioned on the right side of each ...

Issues with the Jquery feedback plugin's functionality are currently preventing it

I wanted to incorporate a feedback feature into my web application. To do this, I searched on Google and found a suitable jQuery plugin. I followed the documentation provided by the plugin, including the library in my HTML file, and then wrote the code as ...

Input fields that are dynamically generated do not respond to changes made using .click and .blur methods in jQuery CSS

I'm experiencing an issue with a HTML form where a new input field is generated when a button is clicked, but the dynamically created field is not styled properly. Below is the HTML form code: <form id="form"> <input type="text" id="ent ...

Transfer information to an array located on a separate webpage by leveraging JQuery and AJAX

I currently have a form that is set up to submit to my cart.php. <form action="cart.php?ID=<?=$row['id'];?>&salec=<?=$row['sale'];?>" method="POST"> <input type="hidden" name="hidden_name" value="&l ...

Ensure that the menu remains hovered even after navigating to the submenu

I have successfully created a menu using CSS and JavaScript that reveals images and text upon hovering over the menu sections. However, I am facing an issue where the colors of the menu items revert back after hovering out. You can view the website here: ...