Creating a customized list item design using Bootstrap 3 and incorporating div elements

I have designed a custom li element with Bootstrap 3, but I am looking to achieve something specific.

.

Here is my current setup-

HTML-

<ul class="list-group">
    <li class="list-group-item" id="baal">
        <div style="display: inline;">
            <div class="inline">
                Anything <img id="image_click" src="http://www.neatimage.com/im/lin_logo.gif">
            </div>

            <div class="inline">
                <img id="image_click" src="http://www.neatimage.com/im/lin_logo.gif">
            </div>

            <blockquote>
                <p>angulard it's obviously tremendously helpful to a lot of people - they took the time to search for a solution,</p>
            </blockquote>
            <div>
                More thing
            </div>
        </div>
    </li>
    <li class="list-group-item">
        <div class="inline">
            <div>
                1
            </div>
            <div>
                2
            </div>
        </div>

        <div class="divider-vertical"></div>

        <div class="inline">
            <div>
                3
            </div>
            <div>
                4
            </div>
        </div>
    </li>        
    <li class="list-group-item">Music</li>
    <li class="list-group-item">Videos</li>
</ul>

The HTML structure of my div is as follows-

<li class="list-group-item">
    <div class="inline">
        <div>
            1
        </div>
        <div>
            2
        </div>
    </div>

    <div class="divider-vertical"></div>

    <div class="inline">
        <div>
            3
        </div>
        <div>
            4
        </div>
    </div>
</li>

And here is the CSS used-

/*  List Item Styling   */
div.inline
{
    float:left;
}

.divider-vertical
{
    height: 50px;
    margin: 0 9px;
    border-left: 1px solid #F2F2F2;
    border-right: 1px solid #FFF;
}
/*  End - List Item Styling */

However, I am encountering some issues where the output differs from what I anticipated. Can anyone provide assistance in resolving this matter?

Your help is greatly appreciated. Thank you.

Answer №1

To achieve a clean layout, make use of the .clearfix class in the following manner:

<li class="list-group-item">
    <div class="inline">
        <div>
            1
        </div>
        <div>
            2
        </div>
    </div>

    <div class="divider-vertical"></div>

    <div class="inline">
        <div>
            3
        </div>
        <div>
            4
        </div>
    </div>
    <div class="clearfix"></div>
</li>  

Here's the corresponding CSS for styling:

/* List Item Styling */
div.inline, .divider-vertical   
{
    height: 50px;
    float:left;
}

.divider-vertical   
{
    margin: 0 9px;
    border-left: 1px solid #F2F2F2;
    border-right: 1px solid #FFF;
}

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

What steps do I need to take to build something similar to this using AngularJS?

Struggling with understanding the concepts of AngularJs. How can I create textfields and animations like the ones in this example using AngularJS? I've tried exploring directives, but it's not quite clicking for me. I've attempted to follow ...

Creating a table in VueJs and populating it with values retrieved from an MSSQL database in a .NET Core web application

I am developing a table within a .NET Core Web Application that includes multiple rows and columns filled with data retrieved from a MSSQL server through a WEB API Given the need for numerous rows and columns, I am considering using a for loop inside my & ...

Creating a webpage with a form is a simple process that involves utilizing both PHP and HTML

Just like creating a post in WordPress or asking a question on this website, I am curious about how to create a page simply by filling out a form. I understand how to build an HTML form, manage data in a database, and have some knowledge of PHP. However, ...

Adjust the height for just one md-tab

Looking to find a way to set the height of the content within an <md-tab> element to be 100% in a flexible manner. For example, consider the following structure: <body> <md-content> <md-tabs> <md-tab label= ...

Adjusting the style attributes for Material-UI Icons

I could use some assistance with changing the CSS property of MUI icons in order to assign a specific color when the icon is focused. I have implemented the icons in the header and am displaying different pages below them, so I would like to give each ac ...

Pictures without a set width

Hey there! I'm working on a responsive website and facing an issue with image resizing. When I shrink the screen size, the images also shrink along with it. How can I set a fixed width for the images? I tried switching from rem to px but that didn&apo ...

Another class is overriding the border of the text-box

I'm facing a challenge in customizing the material ui css. Specifically, I want to set the border color of a textbox to red. The issue arises when the bottom border gets overwritten. Upon investigation, I discovered that the culprit is the class MuiIn ...

Is the space-between property not delivering the desired spacing?

I am trying to achieve equal spacing between list items, and I attempted the following code. ul { list-style-type: none; display: flex; justify-content: space-between; } However, it seems that this approach is not working as expected. I am confused ...

Floating dropdown within a scrolling box

How can I ensure that the absolute positioned dropdown remains on top of the scrollable container and moves along with its relative parent when scrolling? Currently, the dropdown is displayed within the scrollable area. The desired layout is illustrated i ...

Create a customized menu with jQuery that disappears when hovered over

Check out this menu I've created: http://jsbin.com/useqa4/3 The hover effect seems to be working fine, but I'm looking to hide the div #submenuSolutions when the user's cursor is not on the "Solution" item or the submenu. Is there a way to ...

Outlook for Windows automatically sets the default font for HTML emails to Times New Roman

My email design looks great in Mac Outlook, but Windows Outlook is changing the font to Times New Roman. Below is the code for the email template. Can someone help me figure out what I'm missing? <style style="-ms-text-size-adjust: 100%;&q ...

Showing JSON data on a webpage

Hey there, I'm looking to showcase information from a MySQL table in an HTML document. Currently, I have a PHP script that is up and running: <html> <head> </head> <body> <?php $mysqli = new mysq ...

Whenever I press a button, my desire is for each picture to seamlessly reposition itself in the exact same spot on the screen

Having some issues with my code. When I click a button, the plan is for the pictures to change one by one to simulate a traffic light sequence. However, when I run the code, all the pictures appear at once without any effect from the button. Any help in ac ...

Using a PHP variable as the input for the img src attribute in HTML

I am currently working on a project that involves creating a gallery to showcase all the .jpg files from a specific local directory. However, I seem to be encountering some issues with it. <?php $directory = "img/"; $images = glob ...

Utilize AJAX in JavaScript file

I am encountering an issue with the following code: function inicioConsultar(){ $(function(){ $('#serviciosU').change(function(){ if ($('#serviciosU').val()!= "-1") { $.ajax({ url: "@Url. ...

Background image of HTML Iframe element does not display - Inline style block

https://i.stack.imgur.com/JW26M.png After setting the iframe's innerHTML using this line of code: iframedoc.body.innerHTML = tinyMCE.activeEditor.getContent(); The styles for the elements within the iframe are contained in an inline style block. Ho ...

Crop box overlaying video background

Utilizing jCrop to establish a crop region for a video element. My goal is to make the video section within the crop area fill a container with identical proportions, but I'm encountering challenges with the mathematical calculations. The sizes of th ...

Utilizing several carets in a single or multiple text areas and input boxes

Just a quick question... Can a textbox have two carets simultaneously, or can we have two separate textboxes both focused at the same time? I am aware of simulating this using keydown listeners but I'm specifically looking for visible carets in both ...

What is the best way to achieve this effect with CSS?

Is there a way to create this design with CSS? I experimented with applying border CSS and rotating the DIV, but couldn't quite achieve the desired result. Here is an image for reference: https://i.stack.imgur.com/yW6wK.png ...

Working with JQuery to extract and append data stored in a JSON object

I am working with the following JSON data: [ { "MOD_AXL": 0, "MOD_CDS_ID": 110000168, "MOD_CV": 0, "MOD_CV_CTM": null, "MOD_ID": 168, "MOD_MFA_ID": 514, "MOD_PC": 1, "MOD_PCON_END": 199007, "MOD_PCON_START": 196303, ...