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

Troubleshooting the Inline-Block Problem with Jquery Image Bubble Display

Recently, I've been exploring ways to eliminate the padding that is creating space between images before they align correctly. The culprit causing the padding seems to be the display: inline-block property. While it was suggested to have all the li t ...

css: centrally align a collection of items that are spaced evenly throughout the group

I have multiple divs inside a container that I want to evenly distribute horizontally: [container [obj1] [obj2] [obj3] [obj4] ] Additionally, I would like the container to be centered on the page My current CSS (stylus) code for the container is as foll ...

Tips for retrieving the count from HTML using JavaScript:

I need to determine the count of list items in an unordered list within dir-pagination-controls. How can I achieve this using JavaScript? <dir-pagination-controls min-size="1" direction-links="true" boundary-links="true" class="pull-right ng-isolate- ...

Table featuring alternating background colors for rows and a distinct header design

Incorporating CSS, I have managed to style my rows in alternating colors. Take a look at the code snippet below: Fiddle tr:nth-child(odd) td { background-color:red; } tr:nth-child(even) td { background-color:blue; } tr th { background-color: yellow} ...

Encountered an Illegal Invocation error while trying to use Bootstrap Accordion/Collapse

I have implemented the Bootstrap 5 accordion/collapse feature in my project. Although I have followed the BS5 documentation, I encountered a problem that is similar to one posted on StackOverflow a few months ago: Bootstrap Accordion Throws TypeError: Ill ...

``Need help hosting static HTML files on Google App Engine? Here's a step-by-step

Can I use App Engine to host a static HTML website? How can I set up my domain name to work with it? ...

Attempting to limit entry to a pathway when the loggedIn criterion is satisfied

I am currently facing a challenge with restricting access to the login page if the user is already logged in. I have been attempting to achieve this by checking for an existing token in the localStorage. Do you have any suggestions on how I can troublesh ...

Having trouble with the WordPress style file not functioning properly

I'm currently facing an issue while trying to upload a CSS file and a JavaScript file to a custom theme on WordPress. When I open the webpage, nothing appears and there are no elements displayed. However, when I delete the functions.php file, the webp ...

Which target should be specified for pressing Enter in a Javascript Alert using Selenium IDE?

Seeking assistance with creating simple test cases using Selenium IDE. Encountering difficulties when recording test cases involving Javascript alerts, as Selenium does not support these pop-ups. Attempted a workaround by simulating the Enter key press wh ...

Why Isn't the Element Replicating?

I've been working on a simple comment script that allows users to input their name and message, click submit, and have their comment displayed on the page like YouTube. My plan was to use a prebuilt HTML div and clone it for each new comment, adjustin ...

Using Selenium to interact with drop-down lists using div tags instead of select tags

As a newcomer to automated testing using Selenium Web Driver, I am struggling to test drop down lists for the location type without relying on the select command. The element in question is enclosed within a div tag. I attempted sending keys but that meth ...

Using HTML, jQuery, and JSON with an AJAX call to populate two web tables stacked on top of each other

I am encountering an issue with populating two tables using two searches based on user input in mySQL-JSON-AJAX. When the user enters a search term and clicks the corresponding button, data should populate the respective table. The problem arises when clic ...

Getting the user's language in PhoneGap can be done in a variety of ways

I attempted to retrieve the language value of the device using the globalization plugin. I followed all installation procedures, read through the documentation, and searched for answers on this platform, but unfortunately, none of them provided the solutio ...

A combination of fixed width column and dynamic content area in Bootstrap design

Is there a way to achieve the combination of fixed and fluid width columns using Twitter Bootstrap alone, similar to this example? The HTML and CSS in the example make it seem simple. But can this be done solely with Bootstrap? ...

JavaScript confirmation for PHP delete button

Is there a way to implement a JavaScript alert that prompts the user to confirm their action when they click the delete button? I attempted to integrate a class into an alert box: <?php //$con = mysqli_connect("localhost", "root", "root", "db"); $sql ...

Is your bootstrap tooltip appearing in a different location than your mouse cursor on mouse move?

When hovering over multiple images, I want the tooltip to follow the mouse according to this solution. However, sometimes the tooltip appears very far away from the mouse and flickers. Does anyone know why? Additionally, the CSS code provided below doesn& ...

Angular2: Dynamically switch between selected checkboxes in a list

Is there a way to toggle a checked checkbox list in Angular2? I am trying to create a button that, when pressed while the full list is visible, will display only the checked items. Pressing the button again would show the entire list. Here's the Plu ...

"An issue with IE9 causing small dots on rounded corners during rendering

Help Needed: Strange IE9 Rendering Issue I'm experiencing an odd rendering problem in Internet Explorer 9. You see those little white dots on the left? What could be causing them? Any suggestions on how to remove them? Microsoft, why always so myst ...

What is the best way to use CSS to hyphenate a capitalized word?

I have a single word that needs to be hyphenated, but the lang=en hyphenate: auto property does not work on capitalized words. To address this, I utilized the slice function in JavaScript to split the word in half so that the second half, which requires h ...

Creating a personalized webview in Appgyver Steroids: A step-by-step guide

I am planning to design the following layout: The main screen will display a web page There should be a sidebar on the left side The sidebar can be accessed by clicking on a 'hamburger' icon in the app header Currently, my app structure look ...