Floating columns in Bootstrap are a great tool for creating

I'm currently working on implementing a specific design layout using Bootstrap, but I've hit a roadblock.

Here's the desired layout created with plain CSS: http://jsfiddle.net/n3rLx4n1/

And this is what I've managed to accomplish so far using Bootstrap (my comments start after the closing tags for clarity): http://jsfiddle.net/rx4ptj2k/3/

Bootstrap Code:

<div class="container">
    <div class="row">
        <div class="col-md-3 cover">
            <div>COVER</div>
            <div>MENU</div>
        </div>
        <div class="col-md-5 info">
            <div>DETAILS</div>
        </div>
        <div class="col-md-4 tag">
            <div>TAG</div>
            ...
        </div>
    </div>
    <div class="row">
        <div class="col-md-8 yorum">COMMENTS</div>
    </div>
</div>

Plain HTML + CSS:

<div class="container">
    <div class="left">
        <div class="left-1">
            <div class="cover">COVER</div>
            <div class="menu">MENU</div>
        </div>
        <div class="left-2">
            <div class="info">DETAILS</div>
        </div>
        <div class="clear"></div>
        <div class="comments">COMMENTS</div>
    </div>
    <div class="right">
        <div class="tag">
            <div>TAG</div>
            ...
        </div>
    </div>
</div>

CSS:

.info {
        background: red;
    }

.tag {
        background: lightslategrey;
    }

.comment {
        background: cadetblue;
    }

Answer №1

Give this a try: http://jsfiddle.net/rx4ptj2k/4/

The solution involves nesting divs to achieve the desired effect. If you have any questions, feel free to ask...

<div class="left col-sm-8 cover">
    <div class="cover col-sm-4">COVER</div>
    <div class="info col-sm-8">DETAILS</div>
    <div class="menu col-sm-12">MENU</div>
    <div class="comments col-sm-8">COMMENTS</div>
</div>
<div class="right col-sm-4 tag">
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
    <div>TAG</div>
</div>

If you want to get rid of the bootstrap padding, simply remove the first line of CSS with this link: http://jsfiddle.net/rx4ptj2k/5/

Answer №2

To properly structure your content, simply nest the divs within each other. Bootstrap comes with default padding which can easily be removed by using the .no-pad class. Additionally, background colors have been added as inline styles for clearer identification.

.no-pad {
    padding: 0;
}

<div class="container">
    <div class="row" style="background: pink">
        <div class="col-xs-9 no-pad">
            <div class="col-xs-3 no-pad" style="background: red">
                COVER
            </div>
            <div class="col-xs-9 no-pad" style="background: blue">
                DETAILS
            </div>
            <div class="col-xs-12" style="background: orange">
                MENU
            </div>
            <div class="col-xs-9" style="background: purple">
                COMMENTS
            </div>
        </div>
        <div class="col-xs-3 no-pad" style="background: green">
            TAG<br>
            TAG<br>
            TAG<br>
            TAG<br>
            TAG<br>
            TAG<br>
        </div>
    </div>
</div>

http://jsfiddle.net/timgavin/2okk4323/

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

Personalized Bootstrap 4.1 Toggle Animation

I have been attempting to implement a customized menu toggle on Bootstrap 4.0's Navbar menu, using the code provided by Codeply HERE. My goal is to apply the X toggle style to my website's bootstrap navbar. Below is the current setup I have imple ...

I am attempting to create a footer with a set size, but encountering an issue

I'm in the process of developing a responsive website using Vue.js. One aspect I am working on is the footer container, which looks fine on the full screen but shrinks when the screen resolution is reduced below 1100 pixels. As shown in the images li ...

Get rid of the add to cart message and modify the button that says "add to cart" on Woocommerce

How can I modify the shopping cart page to remove the "has been added to your cart" text and replace the quantity and add to cart button with a custom button (my image)? Here is an example of what I am trying to achieve: This is the current state of the p ...

In what ways can a distant ancestor influence its subsequent generations down the line?

As a beginner utilizing Bootstrap v5, I am in the process of creating a navbar using the following HTML code. Within this code, the parent element (ul) of my link items contains a class called "navbar-nav" which results in my link items being styled to s ...

Scroll positioning determines the height of an entity

Here's a code snippet I'm working with: HTML: <div id="wrap"> <div id="column"></div> </div> CSS: #wrap { display: block; height: 2000px; width: 400px } #column { display: block; height: 20px; ...

Unusual CSS problem- What's causing this display issue in Google Chrome?

If you take a look at this specific page: Upon viewing it in Internet Explorer or Firefox, everything appears to be normal. However, when viewed in Chrome, there seems to be some sort of issue present. The navigation area is oddly pushed down, causing the ...

Maintaining an element's vertical position in relation to the screen with jQuery

I'm very close to achieving what I want, but my goal is a bit unconventional. My setup includes several panels divided into 2 columns, with each panel capable of triggering an expand/compress toggle. My challenge is maintaining the vertical position ...

Struggling to align my Navbar items in one clean line, they seem to pile up and remain fixed on the left side. Utilizing ReactJS and MUi5

I'm struggling with aligning my Navbar items (NavLink) horizontally in one line instead of being stuck on the right side and stacked on top of each other. Can someone help me fix this issue? Here's the code snippet: import React from "react& ...

Menu secured in place within the wrapper

My website is contained in a wrapper with a max width, and I have a fixed side menu that can be toggled with a button. The problem I am facing is keeping the fixed side menu within the page wrapper. Fixed elements are typically positioned relative to the ...

Enhancing WordPress Menus with Icons in PHP

Is there a way to customize the HTML output of a menu created with wp_nav_menu()? I want to include < i > tags within the link < a > of each < li > item in the menu. I understand that I could achieve this using background-images in the C ...

Is there a method to style the parent DIV using CSS when the IDs of the child DIVs are

Similar Question: Looking for a CSS parent selector? If I am unable to modify the HTML file, is it possible to apply CSS styles to the parent DIV using only the ID of the direct child DIV? Here's an example scenario: <div> <div id="c ...

The overlay background on the image does not seem to be functioning correctly

I'm currently working on adding an overlay to my image in order to darken it and display text over the top. I've tried using absolute positioning for both the image and overlay, but the overlay ends up covering the entire window and sitting above ...

The background color feature of a div is malfunctioning

I have encountered a strange issue with one of my Div elements. When I add text inside the div, the background color sticks to the text. However, if there is no text present, the background color disappears. Image with Text: https://i.stack.imgur.com/oYK ...

Creating a centered floating card within a div that shrinks to fit its contents: A CSS how-to guide

I am facing a challenge with positioning a floating card that needs to be centered over the parent div (which happens to be selectable because it's a map). So far, I have only managed to achieve this by setting a fixed width for the card using the fo ...

The use of CSS float creates spaces between elements

Is there a way to stack the green DIVs on top of each other without any space between them in the given simple HTML code? I'm puzzled by the gap between the third and fourth green DIVs. * { margin: 0; } .left { width: 20%; background-color: # ...

Disable the click functionality while preserving the hover feature

Due to my previous question being incorrectly marked as a duplicate, even though it wasn't, and no one is rectifying the mistake, I am re-posting my inquiry. I am dealing with an <a> element that has a default onClick function. This <a> a ...

CSS Drop-down Twitchy

I'm currently working on a website project and implementing a CSS-only dropdown menu with some CSS3 features. However, the client has requested specific menu items that are pushing the boundaries of their containers, resulting in some twitchiness duri ...

The back-to-top feature is malfunctioning in the new Bootstrap 4 update

I've been working on adding a back-to-top button to my website using JavaScript in Bootstrap 4 with the Font Awesome icon set. It was functioning perfectly until I made some changes to the site, and now it's not working anymore. I'm pretty n ...

Eliminate any vacant areas within a container and shift the container, along with its contents, on the webpage

I want to eliminate the empty space within the container while maintaining some spacing around the black box, and ensure responsiveness. Additionally, how can I shift the container with its content downwards and to the right of the webpage, while still ke ...

Adapt a dynamic nested flexbox grid into a stacked layout optimized for mobile devices

Utilizing the power of the CSS3 Flexible Box layout has been crucial in developing a responsive site that caters to various devices. On desktop screens, I have successfully implemented a flexbox layout that looks like this: body { text-align: center; ...