Tips for positioning a checkbox alongside labels within a container in Bootstrap

I am looking to create an onclick popup feature.

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

This is the progress I have made so far.

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

Currently, the layout takes up the entire page and I'm having difficulty aligning labels with checkboxes as they appear below the checkboxes and cannot be moved. I would appreciate any suggestions, especially in using bootstrap. As a beginner, I am finding it challenging to grasp all the concepts, despite reading documentation.

CSS:

body{
    padding:0;
    margin:0;
  }
  
  .signupContainer{
    height:100%;
    position:absolute;
    overflow:hidden;
    background-color: white;
    box-shadow: 15px 9px 26px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin: 0 auto;
  }

  .box{
    position:absolute;
    height:100%;
    width:50%;
    margin-top: 55px;
    font-family: 'Poppins', sans-serif;     
    padding-bottom: 140px;
  }

  .box h1{
    text-align:center;
    margin: 0 auto;
    font-size:30px;
    margin-bottom: 20px;
  }
  
  .box input{
    font-family: 'Poppins', sans-serif;
    display:block;
    width:300px;
    margin:0px auto;
    padding:5px;
    text-align: center;
    background: #F8F8F8;
    color:#fff;
    border:0;
    border-radius: 20px;
    margin-bottom: 20px
  }
  .box input:focus,.box input:active,.box button:focus,.box button:active{
    outline:none;
  }

  .box label {
      font-family: 'Poppins', sans-serif;
  }

  .box button{
    background: #FE6047;
    border:0;
    color:#fff;
    padding:5px;
    font-size:20px;
    width:300px;
    margin:20px auto;
    display:block;
    cursor:pointer;
    border-radius: 20px;
  }
  .box button:active{
    background:#27ae60;
  }
  .box p{
    font-size:14px;
    text-align:center;
  }
  .box p span{
    cursor:pointer;
    color:#666;
  }

  input[type=checkbox] {
    margin: 2px 0 0;
    align-self: flex-start;
}

HTML:

    <div class="signupContainer col-6">
      <div class="box col-12">
        <h1 class="col">Sign up</h1>
        <input type="text"  class="col" placeholder="Username"/>
        <input type="email" class="col" placeholder="Email"/>
        <input type="text"  class="col" placeholder="Country"/>
        <input type="password" class="col" placeholder="Password"/>
        <input type="password" class="col" placeholder="Repeat Password"/>
         <label for="seller" class="checkbox-inline"><input type="checkbox" id="seller" >Seller</label>
       <label for="buyer" class="checkbox-inline"><input type="checkbox" id="buyer" > Buyer</label>
        <button class="col">Sign Up</button>
      </div>
    </div>

Any advice or tips would be greatly appreciated as I continue to learn and improve this project!

Answer №1

Check This Out:

HTML Code Snippet:

<div class="ContainerSignUp">
  <div class="ContainerHeaderBG"></div>
  <div class="signupContainer col-6">
    <div class="box col-12">
      <h1 class="col">Join Now</h1>
      <input type="text"  class="col" placeholder="Username"/>
      <input type="email" class="col" placeholder="Email Address"/>
      <input type="text"  class="col" placeholder="Country"/>
      <input type="password" class="col" placeholder="Password"/>
      <input type="password" class="col" placeholder="Confirm Password"/>
      <label for="seller" class="checkbox-inline">
        <input type="checkbox" id="seller">Seller
      </label>
      <label for="buyer" class="checkbox-inline">
        <input type="checkbox" id="buyer">Buyer
      </label>
      <button class="col">Join Us</button>
    </div>
  </div>
</div>

CSS Styles:

body {
    padding: 0;
    margin: 0;
}

.ContainerSignUp {
  position: relative;
  background: blue;
}

.ContainerHeaderBG {
  width: 100%;
  height: 200px;
  background: green;
}

.signupContainer {
  width: 500px;
  max-width: 90%;
  top: 100px;
  left: 50%;
  transform: translateX(calc(-50% + 0.1px));
    position: absolute;
    overflow: hidden;
    background-color: white;
    box-shadow: 15px 9px 26px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    margin: 0 auto;
}

.box h1 {
    text-align: center;
    margin: 100px auto 0;
    font-size: 30px;
    margin-bottom: 20px;
}

.box input {
    font-family: 'Poppins', sans-serif;
    display: block;
    width: 80%;
    margin: 0px auto;
    padding: 5px 20px;
    text-align: left;
    background: #F8F8F8;
    color: #fff;
    border: 0;
    border-radius: 20px;
    margin-bottom: 20px;
  color: #000;
}

.box input:focus,
.box input:active,
.box button:focus,
.box button:active {
    outline: none;
}

.box label {
    font-family: 'Poppins', sans-serif;
  display: block;
  width: 80%;
  margin: auto;
}

.box button {
    background: #FE6047;
    border: 0;
    color: #fff;
    padding: 5px;
    font-size: 20px;
    width: 300px;
    margin: 20px auto;
    display: block;
    cursor: pointer;
    border-radius: 20px;
}

.box button:active {
    background: #27ae60;
}

.box p {
    font-size: 14px;
    text-align: center;
}

.box p span {
    cursor: pointer;
    color: #666;
}

input[type=checkbox] {
    margin: 2px 0 0;
    align-self: flex-start;
}


/* Customization */

input#seller,
input#buyer {
    display: inline;
    width: 11px;
    margin-right: 10px;
}

This example was created and shared on CodePen:
CodePen Example

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

Ways to avoid Bootstrap popovers from automatically breaking lines

I am struggling with adding a tooltip using Bootstrap's popover. Here is what I have tried: <ul> <li>Entry 1 ....................................................................</li> <li>Entry 2 ...................... ...

Issue with Modal popup not being visible upon the page's initial loading (utilizing bootstrap

I am having trouble displaying a Bootstrap modal on page load to show a message about the use of cookies on my website. <div class="modal fade show" id="cookieModal" tabindex="-1" role="dialog" aria-labelledby=& ...

Working with double quotes within variable in JavaScript

I am currently working on dynamically creating HTML tags using JavaScript. Please take a look at the code snippet below: function getPhotosSuccess(data) { if (data.d.results.length > 0) { var response = data.d.results; var innerht ...

When applying a gradient on top of an image with background-image, the gradient appears larger in size compared to

Struggling with HTML <div class="outer"> <div class="bgimagegradient"></div> <img src="foo.jpg"> <div> .backgroundimage { position: absolute; right: 25px; z-index: -100; ...

Exploring JSON Object with ng-disabled in AngularJS

One unique feature of my web application is the ability to add new users (username + password) through a form. To prevent duplicate usernames, I have a JSON object called l_usernames defined in a controller named UsersController. This object contains all u ...

Troubleshooting: Button Functionality Issue in HTML and Javascript

Currently, I am in the process of completing my final project for an introductory web development course. While I am very new to javascript and html, the project itself is a simple Mad Libs task. Throughout the day, I have encountered numerous issues attem ...

Utilizing Kendo for Dynamic HTML Element Connection

Currently, I am facing a situation where I have three HTML elements. The first is a textbox labeled shipToAddress, the second is another textbox called deliverToAddress, and finally, there is a checkbox named sameAsShipToAddress. In the background, there ...

Display the title tag when hovering over an image

Hey there! I'm looking to display the title tag of an image directly inside the image itself. Here's an example to illustrate what I mean: http://jsfiddle.net/51csqs0b/ .image { position:relative; width:200px; height:200px; } .ima ...

Tips for converting a toolbar into a side navigation bar when resizing the window (shrinking)?

Check out this example When the browser is maximized, it should show the toolbar and its content. However, if the browser window is resized, a new side nav bar should appear. How can I implement this feature? How do I utilize media queries to achieve this ...

Utilize various stylesheets for separate components within Angular Webpack

I've been tasked with revamping the design of a Angular Webpack project, and I'm looking to incorporate Bootstrap for all new designs. However, the previous developer used Typebase.css for all webpages, causing CSS conflicts between Typebase and ...

When files are uploaded onto the server, clicking on drop-down links does not produce any output

The functionality of the bootstrap drop down links is working perfectly on localhost, opening the drop down upon clicking. However, once the files are uploaded to the server, the drop down links stop working and only display a blank output when clicked. ...

Issues arise when using jQuery to manipulate HTML content within an Asp.Net environment

Recently, I found myself in a puzzling situation with a div that has the attribute runat="server". <div id="results" runat="server" class="results"></div> Using jQuery, I added HTML content to this div. $('.results').html('Add ...

Placing a Label Next to an Input Field using Bootstrap 4

Is there a way to position the label right next to the input form? I've attempted different methods without success. Could you please review my code below? <div class="modal-body"> <form class="form-horizontal"> <div cl ...

Send folder to the homepage of the website

I want to implement a redirect using .htaccess to prevent people from snooping into my directories and index files. For instance, if someone tries to access a specific image file like site.com/pics/1.jpg by trying to see the entire "pics" folder at site.co ...

Finding results in AngularJS by typing at least 4 characters into the input field

I am using a MySQL database to search with AngularJS. How can I set it up so that the search only triggers when at least 4 characters are inputted? Here is the HTML code: <div class="search"> <form action="" method="post" class="searchform" &g ...

Utilizing jQuery to Extract HTML Data Attributes

Is there a way to access and extract the values stored in the data attributes with jQuery? <div class="sm-tot" data-ts-speed="500" data-ts-interval="4000" data-ts-newVal="5000" > ...

Utilize jQuery, Flash, or HTML5 to upload an image

Does anyone know of an upload tool or plugin that has a similar look and functionality to the one used on Codecanyon's website? I tried Uploadify, but it doesn't work on all browsers. I need something that is compatible with all browsers, whether ...

Looking for a way to use JSON data in a dropdown menu to trigger a

After fetching a JSON file to fill my dropdown menu, I want each selected area to redirect to a specific URL. However, I'm unsure how to achieve this. Do I need to use JavaScript to trigger the onclick event for the URL? HTML: <div class="btn ...

Placing a small image on top of multiple images using CSS

I am facing a CSS issue and I need help with positioning a small image (using position absolute) like a warranty badge on top of larger images. The challenge is to ensure that the badge is fixed at the bottom left corner of each image, despite variations ...

The webpage transforms with the holiday spirit

I have created multiple backgrounds for my website (available here), and I am looking for a way to have them automatically change based on specific occasions like Christmas, Halloween, etc. Manually changing them is an option, but where's the fun in t ...