HTML Bootstrap - Organizing Labels and Checkboxes in a Grid Layout

I've been attempting to achieve a specific design using bootstrap and html, but I've hit a roadblock. No matter what I try, the design doesn't seem to work. Here's the code I've been working with. Can you please offer some guidance? I initially attempted with bootstrap, but then switched to HTML and CSS:

body {
  font-size:1.5em;
  color: #2b2b2b;
  background:white;
}
.label-check input {  display:none; }

.label-check label::before {
  width: 1.4em;
  text-align: center;
  display: inline-block;
  cursor: pointer;
  color: black;
  transition: color .3s ease;
  text-shadow: 0px 0px 1px #cccccc;
}
.label-check label:hover::before {
  text-shadow: 0px 0px 1px #6286d0;
}
.label-check [type='checkbox']:checked + label::before,
.label-check [type='radio']:checked    + label::before{ 
  color: #056dce;
}
<div class="label-check">
  <p class="m3">File Type</p>
  <div>
    <input type="checkbox" name="checkGrp1" id="check1_Opt1">
    <label for="check1_Opt1">jpg</label>
    <label for="check1_Opt1">2</label>
  </div>
  <div>
    <input type="checkbox" name="checkGrp1" id="check1_Opt2" checked>
    <label for="check1_Opt2">pdf</label>
    <label for="check1_Opt1">4</label>
  </div>
   <div>
    <input type="checkbox" name="checkGrp1" id="check1_Opt2" checked>
    <label for="check1_Opt2">mp4</label>
    <label for="check1_Opt1">6</label>
  </div>
</div>

<hr>
  <p class="m3">Orientation</p>
Horizontal              &#10696; <br/>
Vertical             &#10696; <br/>
Square             &#10696; <br/>
 <br/>

Answer №1

If you're in need of a solution for a bootstrap grid, you might want to consider the following code snippet

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c2a0adadb6b1b6b0a3b282f6ecf4ecf0">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">


<div class="label-check container">
  <p class="m3">File Type</p>

  <div class="row">

    <div class="col">

      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">jpg</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>

      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">pdf</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>

      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">tif</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>

    </div>

    <div class="col">
      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">docx</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>

      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">png</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>

      <div class="row">

        <div class="col">
          <input type="checkbox" name="checkGrp1" id="check1_Opt1">
          <label for="check1_Opt1">doc</label>
        </div>

        <div class="col text-right">
          <label for="check1_Opt1">2</label>
        </div>

      </div>
    </div>

  </div>

  <hr>

  <p class="m3">Orientation</p>


  <div class="row">
    <div class="col">
      Horizontal
    </div>

    <div class="col text-right">
      &#10696;
    </div>

  </div>

  <div class="row">

    <div class="col">
      Vertical
    </div>

    <div class="col text-right">
      &#10696;
    </div>

  </div>

  <div class="row">

    <div class="col">
      Square
    </div>

    <div class="col text-right">
      &#10696;
    </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

The rating and comment section is failing to adapt to smaller screens, creating a terrible user experience

I am a beginner with Sass and CSS. I wanted to create a rating and comment section which looks fine on a laptop screen, but appears off on smaller screens. It seems like the layout might be incorrect or maybe I didn't follow grid layout guidelines pro ...

Preload-webpack-plugin does not support pre-fetching files

I have a query about prefetching and preloading content. In my vue app, I noticed that after building, I have duplicate files loaded in my dist/index.html file. Here is an example: Additionally, the "scripts" are not being preloaded/prefetched as expec ...

Error encountered when using the $.post function

$(".eventer button[name=unique]").click(function() { console.log('button clicked'); thisBtn = $(this); parent = $(this).parent(); num = parent.data('num'); id = parent.data('id'); if(typeof num ! ...

Using Angular 4 to delete selected rows based on user input in typescript

I am facing a challenge with a table that contains rows and checkboxes. There is one main checkbox in the header along with multiple checkboxes for each row. I am now searching for a function that can delete rows from the table when a delete button is clic ...

Responsive HTML5 audio player adjusts size when viewed on mobile devices

I am facing a challenge with an HTML5 Audio player. It looks fine on desktop but behaves strangely on mobile devices. While the width remains intact, it repositions itself and floats over the element it is contained within. How can I prevent this repositio ...

Defining the active element in the menu using JavaScript

I need help with my navigation menu: <ul> <li id="active"><a href="/">Home</a></li> <li><a href="/about/">About Us</a></li> <li><a href="/services/">Our Services</a>< ...

Implementing CSS Media Print, tables elegantly transition to a fresh page

I am encountering a challenge when it comes to printing my dynamic table along with some preceding text. It seems that sometimes the table begins on a new page, resulting in the header test being isolated on the first page and only displaying the table on ...

CSS- The ultimate guide to perfectly centering a webpage without the need for extra margins!

Our SharePoint 2013 generated web page has a width of 1024. The main content div is styled as follows: #container_master { width:1024px !important; margin-left: auto !important; margin-right: auto !important; background-color:#FFF !impor ...

Explaining the Usage of Nav-pills in Bootstrap v4

I am looking to align my navigation bar across the width of the div. However, I am currently using Bootstrap v4 and the nav-justify class is not available yet. Below is the code snippet: <ul class="nav nav-pills"> <li class="nav-item"> ...

Personalize Autocomplete CSS based on the TextField input in React Material UI when a value is present

In my current project, I am utilizing React Material Autocomplete fields, which includes a nested TextField. I have successfully implemented standard styles for when the field is empty and only the label is visible, as well as different styles for hover ef ...

Concealing a child component when hovering over its parent element with styled-components

I have a react component structured like this - const MyComponent = () => ( <ContainerSection> <DeleteButtonContainer> <Button theme="plain" autoWidth onClick={() = ...

How can I feature an image at the top of the page with large 3 and jQuery in FireFox?

I am interested in showcasing a single image at the forefront of the page when it is selected. While there are numerous plug-ins that offer this feature, many come with unnecessary extras like galleries, video support, and thumbnails which I do not requir ...

iPhone-compatible iFrame with adaptable webpage dimensions

While attempting to embed our page on a client's site, everything looks great in a browser and our media queries are functioning properly. However, we encountered an issue when viewing the embedded page inside an iframe on an iDevice. It seems that th ...

Positioning borders in an Outlook table

While experimenting with Mjml, I encountered an issue where I struggled to place the border exactly where it needed to be in order for my table to function correctly. It was a bit of a do-it-yourself solution, but it was the only way I managed to make it w ...

Download the PDF instead of just viewing or downloading it through a link

I need help configuring a link so that when the user clicks "download here," a PDF file is automatically downloaded to their desktop. Can someone provide guidance on how to achieve this? ...

Node.js script encounters errors fetching static files

My HTML index.html file has multiple containers, and I have included the bootstrap and font awesome folders in the <head> section like this: <link href="../bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="../bootstrap/css/bootstra ...

Learn how to simultaneously play two audio files using the same identifier in JavaScript

I'm facing an issue with two audio files that have a progress bar and both have the same ID: <audio id="player" src="<?=base_url('mp3/'.$rec->file)?>"></audio> </p> ...

Customize the printing settings within bootstrap by modifying the background color from transparent to a solid color using CSS/SCSS

I am facing an issue with the bootstrap CSS/print feature. In the bootstrap CSS (reset.css) file, all styles are cleared for printing purposes. @media print { * { text-shadow: none !important; color: black !important; background: transparen ...

Use .empty() method to remove all contents from the tbody element after creating a table

Currently, I am working on a project where I am creating a drop-down list to assist users in selecting media and ink for their printers. The goal is to then generate a table displaying the selected results. While I have managed to successfully generate the ...

What is the purpose of a form that includes a text input field and a button that triggers a JavaScript function when the enter key is pressed?

<form action=""> <input id="user_input" onKeyDown="if(event.keyCode == 13)document.getElementById('okButton').click()" > <input id="okButton" type="button" onclick="JS_function();" value="OK"> </form> I'm trying to a ...