How to implement an 8-column layout within a 12-grid bootstrap framework?

Hey guys, so I've been trying to recreate this page with Bootstrap and it's all going smoothly except for this one part. Here is the link I'm referring to:

I have 2 questions:

  1. Which HTML element should I use for these lines?
  2. Any idea on how I can divide the 12-column layout into 8 equal parts?

Below is a snippet of the code I've been working on:

<div class="container" style="margin-top: 3%;">
    <div class="row">
        <div class="col-xs-6 col-xs-offset-3">
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <input type="text" class='form-control' placeholder="First Name">
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <input type="text" class='form-control' placeholder="Last Name">
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <input type="text" class='form-control' placeholder="Display name">
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <input type="text" class='form-control' placeholder="Email Address">
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <input type="password" class='form-control' placeholder="Password">
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <input type="password" class='form-control' placeholder="Confirm Password">
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xs-3">
                    <button class="btn btn-secondary">I Agree</button>
                </div>
                <div class="col-xs-9">
                    <p>
                        By clicking <span class="label label-primary">Register</span>, you agree to the <a href=#>Terms and Conditions</a> set out by this site, including our Cookie Use.
                    </p>
                </div>
            </div>

            <div class="row">

            </div>

            <div class="row" style="">
                <div class="col-xs-6">
                    <button class="btn btn-primary btn-block" style="font-weight: bold;">Register</button>
                </div>
                <div class="col-xs-6">
                    <button class="btn btn-success btn-block" style="font-weight: bold; ">Sign In</button>
                </div>
            </div>

        </div>
    </div>
</div>

Answer №1

Another approach is to divide the row into two halves, with each half containing four sections, as illustrated below:

<div class="row">
    <div class="col-xs-6>
        <div class="row">
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
        </div>
    </div>
    <div class="col-xs-6">
        <div class="row">
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
            <div class="col-xs-3></div>
        </div>
    </div>
</div>

This method creates eight equal sections while minimizing the use of additional wrappers.

You can experiment with different HTML elements for these lines - try using div, span, or even hr. Have fun exploring! :)

Answer №2

give this a shot

<div class="row">
  <div class="col-xs-2></div>
  <div class="col-xs-8">{YOUR COLORS HERE}</div>
  <div class="col-xs-2></div>
</div>

To showcase your colors, you could present them as an image or enclosed in divs within a container to ensure they line up consistently on the same row.

 <div style="position:relative;display:block;width:100%;height:16px">
  <div style="position:relative;display:inline-block;width:12.5%;background-color:red"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:blue"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:green"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:orange"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:teal"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:cyan"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:purple"></div>
  <div style="position:relative;display:inline-block;width:12.5%;background-color:black"></div>
 </div>

This method ensures balanced spacing around your colorful row :) hoping it works out for you. You can apply the same technique to all rows to keep everything aligned like the image, with a bit of padding and centered. Alternatively, divide the row into 2 (6) sections, then each section into 4 (3)

Answer №3

give this a shot

<div class="row">
    <div class="row col-xs-3">
        <div class="col-xs-6"></div>
        <div class="col-xs-6"></div>
    </div>
    <div class="row col-xs-3">
        <div class="col-xs-6"></div>
        <div class="col-xs-6"></div>
    </div>
    <div class="row col-xs-3">
        <div class="col-xs-6"></div>
        <div class="col-xs-6"></div>
    </div>
    <div class="row col-xs-3">
        <div class="col-xs-6"></div>
        <div class="col-xs-6"></div>
    </div>
    <div class="row col-xs-3">
        <div class="col-xs-6"></div>
        <div class="col-xs-6"></div>
    </div>
</div>

or how about

<style>
.colorbar{
    display: inline-block;
    margin: -2px;
    width: 12.5%;
    height: 10px;
}
/*add some color*/
</style>
<div class="row">
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
    <span class="colorbar"></span>
</div>

Answer №4

One of the simplest methods I employed to achieve this style was through utilizing HTML5 Canvas. Here is the code snippet:

<!DOCTYPE html>
<html>

<head>
    <style type="text/css">

        #myCanvas {
            width: 500px;
        }

    </style>
</head>

<body>

    <canvas id="myCanvas" width="800" height="20" >Your browser does not support the HTML5 canvas tag.</canvas>

    <script>
        var c = document.getElementById("myCanvas");
        var line1 = c.getContext("2d");
        line1.beginPath();
        line1.moveTo(0,0);
        line1.lineTo(100,0);
        line1.lineWidth = 20;
        line1.strokeStyle = "#6FCCAC";
        line1.stroke();

        // The rest of the lines follow similar pattern with different colors

    </script>

</body>
</html>

If you're interested in learning more about Canvas, here are some recommended sites:

  • html5canvastutorials
  • W3 Schools
  • MDN
    Explaining the code further... You'll notice a style tag within the head tags. This code accurately sets the canvas's actual width, which may differ from the one specified in the canvas tag. The width and height in the canvas tag simply define the work area for drawing, whereas each hexadecimal color code represents the color of the lines.

    I hope this explanation proves helpful...

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

Safari shows a contrasting outcome

Having an issue with compatibility in the safari browser You can check out the site here: The problem lies with the text inside the image, I want it to display properly like it does in Chrome. Here is the desired result for Safari as well. Below is the ...

Bootstrap dropdown menu fails to adapt to updated navbar height

I recently made a modification to the navbar size on my website, increasing it from 50px to 63px by tweaking a line in the bootstrap.css file. The exact code snippet I utilized for this adjustment is as follows: .navbar { position: relative; min ...

Setting the height of a child tag: A step-by-step guide

When trying to set the height of a child tag to 100%, I encountered an issue where the height would remain fixed after redirecting to another page, preventing the page from scrolling. Styling for Image 1 body{ background: url("Resources/Cash.jpeg&q ...

Implementing a distinct approach to adding margins to div boxes using

Hello, I've been experimenting with the developer tools in Google Chrome to add margins to my navigation bar. The goal is to create gaps between the boxes. Any assistance would be greatly appreciated! http://jsfiddle.net/3jp1d0fe/8/ CSS div.contain ...

Error with Display of ASCII Character 62 in Superfish Menu

Currently, I have implemented the Superfish menu on my website. In order to indicate sub-menus within my menus, I have opted to utilize the character entity code &#62;, which historically has represented ">". Oddly enough, while viewing my website on ...

Unforeseen box model quirks found in modern browsers when styling <table> elements

Here is a sample HTML document that demonstrates the issue: <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; ...

Enhancing File Uploads with Vuetify

For my Vue.js project, I am attempting to upload a file using Vuetify and then store that uploaded file in my data object. This is the HTML code: <input id="file-upload" type="file" @change="onFileChange"> Within my methods section, I have the fol ...

What is the process for extracting HTML tables from files using pandas?

I am a beginner at pandas and I am attempting to extract data from HTML files. How can I convert multiple HTML tables like the ones below: PS4 Game Name | Price GoW | 49.99 FF VII R | 59.99 XBX Game Name | Price Gears 5 | 49.99 For ...

What is the significance of the space between form.validate and .ng-invalid-email.ng-dirty?

I'm currently working on an AngularJS application and I'm confused about the spacing between "form.validate" and ".ng-invalid-email.ng-dirty" in the stylesheet code below: <style> form.validate .ng-invalid-required.ng-dirty {background ...

Is your WordPress one-page scroll JQuery script failing to function properly?

Currently attempting to develop a single page scroll feature. Within WordPress, my navigation contains anchor tags structured as follows: <a href="#contact">Contact</a> <a href="#about">About</a> The corresponding divs for the li ...

What is the best way to showcase this information within my columns?

I'm facing an issue with VueJS. I have a large dataset that I want to display in columns in a specific order. How can I properly insert the code for this? Thank you for any assistance. [ { "sort": 0, "title": "My title", "description": ...

Angular app encounters issue with Firebase definition post Firebase migration

Hey there, I'm currently facing an issue while trying to fetch data from my Firebase database using Angular. The error message 'firebase is not defined' keeps appearing. var config = { databaseURL: 'https://console.firebase.google. ...

Tips for inserting manual line breaks in justified text

My task involves taking a 5-page story from a Word document and implementing it on a website. #reading { hyphens: auto; text-align: justify } <div style="font-size: 20px; width: 750px; margin-bottom: 4em;" class="reading" id="reading"> TextT ...

Applying toggle() using css to manipulate various elements at once

Is there a way to toggle multiple divs of varying heights, all with the same class? What is the most effective approach to achieve this? http://jsfiddle.net/hS6RH/41/ $('.smallify').on('click', function() { if ($(this).parent(&apo ...

A step-by-step guide to showcasing dates in HTML with Angular

I have set up two datepickers in my HTML file using bootstrap and I am attempting to display a message that shows the period between the first selected date and the second selected date. The typescript class is as follows: export class Datepicker { ...

The background image in CSS fails to display when a relative path is utilized

Currently, I am working on a JavaFX project which has the following file structure (CEP serves as the root directory): CEP +img menu.jpg +src +css_files MainMenu.css The main objective is to set the background image from the img dir ...

Text parsing with jQuery

Hello fellow developers. I am interested in creating a text parser using jQuery. My goal is to develop a function that can take a string as input and convert it accordingly. Imagine we have a div with the following HTML structure: <div class="item"> ...

Looping through elements with jQuery's `each` method within another `

When using div containers in my code, I wanted to loop over them and then iterate through the items within each container. Instead of $('.stackContainer .stackItem').each(, I was looking for a solution like this: // setup stacks $('.stackC ...

Button color changes upon submission of form

Can anyone help me figure out how to change the color of a submit button after a form submission using Twitter Bootstrap 3? I have a form with multiple buttons serving as filters for my product page, but I can't seem to change the color of the selecte ...

Media publications do not conform to the current trends

I'm currently utilizing the HTML-to-paper plugin to print my content on a printer. However, I've encountered an issue where it doesn't seem to apply any of the styles I've defined within @media print. The challenges I'm encounteri ...