What is the best way to insert two rows directly in the middle of two Bootstrap columns?

I need to align two rows in a straight line.

Similar to the example shown in the image below:

https://i.sstatic.net/EwRat.png

After that, I want to split the Bootstrap into two columns, one with col-md-8 and the other with col-md-4.

In the col-md-8 column, I further divide it into col-md-3 containing an <hr> tag and col-md-9 containing an <h4> text along with all the content.

In the col-md-4 column, it remains as col-md-12. No need to divide <hr> in any columns here.

Then, I add text with an <hr> tag, making the alignment not straight in both columns.

My code structure is as follows:

 // CSS Code Block
                div.hr_tinkhuyenmai{
                    height: 1px;
                    width: 10%;
                    background-color: #ffa800;
                }
                div.title_tinkhuyenmai{
                    font-family: tahoma;
                    display: flex;
                    align-items: center;
                    justify-content: left;
                }
                // More CSS styles...

                // HTML Code Block
                <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
                <div class="container-fluid remove_padding" style="background-color: #f8f8f8;margin-top: 20px">
                  <div class="row">
                    <div class="col-md-12">
                      <div class="col-md-8">
                        <div class="title_tinkhuyenmai">
                          <div class="col-md-3 hr_tinkhuyenmai"></div>
                          <div class="col-md-9">
                            <h4>TIN KHUYẾN MÃI</h4>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-4">
                        <div class="group_title_hr col-md-12">
                          <div class="title_child_breakingnews text-right">TIN NỔI BẬT</div>
                          <div class="hr_child_breakingnews text-right"></div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
            

Answer №1

To achieve a design similar to the image, you need to adhere to these instructions:

------------:------------------- ----------------- -------------------------------
|    <hr>   |       TEXT       | |  Middle Div   | | Text |         <hr>         |
-------------------------------- ----------------- -------------------------------
            |                  |                        |   C1   |
            |      Image       |                        |   C2   |
            --------------------                        |   C3   |

Code pattern: (For header part)

    <div class="row">
       <div class="col-md-8">
           <div class="col-md-3">

           </div>

           <div class="col-md-9">

           </div>
       </div>

       <div class="col-md-4">
           <div class="col-md-x">

           </div>

           <div class="col-md-x">

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

Implementing the code:

<div class="container-fluid remove_padding" style="background-color: #f8f8f8;margin-top: 20px">
            <div class="row">
                <div class="col-md-12">
                    <div class="col-md-8">
                        <div class="title_tinkhuyenmai">
                            <div class="col-md-3 hr_tinkhuyenmai"></div>
                            <div class="col-md-9">
                                <h4>TIN KHUYẾN MÃI</h4>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="col-md-12">
                             <div class="col-md-4 group_title_hr">
                                <div>TIN NỔI BẬT</div>
                             </div>

                             <div class="col-md-7" style="margin-top: 17px; ">
                                <div class="hr_child_breakingnews text-right"></div>
                             </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

** Task completed. :P

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

Tips for concealing an entire menu on WP, with the exception of items labeled as current-menu-ancestor

On my Wordpress site, I am faced with a simple problem to solve. I have a primary menu at the top and a secondary menu on the left side. While the top menu only contains level 1 items, the left menu has all the items. To customize the left menu, I am utili ...

Issue with CSS File not being recognized by React Component

After using the webpack create-react-app with npx, I encountered an issue with my component styling. Despite having a CSS file named header.css in the src directory alongside Header.js, my component does not seem to be styled correctly. Here is how my comp ...

Is there a way to create an image gallery layout similar to Pinterest using CSS?

I am currently developing a dynamic PHP gallery that will feature thumbnails with the same width but varying heights. These thumbnails will be arranged from left to right, so I would prefer not to use a traditional five-column layout. I suspect that achiev ...

Is there a way to implement hover behavior for a Material-UI Button within a ButtonGroup component?

When using MUI v5, I am encountering an issue where the first button in the code provided is only half working. The button is initially colored red (both the border and text), however, upon hovering over it, the color of the border changes to blue. This is ...

Issue with Fluid Square Divs and Box-Sizing

I'm currently working on creating a responsive fluid div that maintains its square shape as the page is resized. I've come across a method that involves using the following CSS code: div{ width:25% padding-bottom:25%; } However, it seem ...

The function is defined, but it cannot be set to null

Having trouble understanding this error message "Cannot set properties of null." I'm attempting to update the innerHTML with the output text from four functions that my button triggers. However, it seems to be stopping at the first function now even t ...

Using BootstrapValidator for conditional validation

While utilizing the BootstrapValidator plugin for form validation, I encountered a specific issue. In my form, I have a "Phone" field and a "Mobile" field. If the user leaves both fields blank, I want to display a custom message prompting them to enter at ...

How can I create a single button to toggle the opening and closing of a div using this jquery code?

$(document).ready(function(){ $('#content1').hide(); $('a#openClose').click(function(){ if ($('#content1').is(':visible')) { $('#content1').hide(&apos ...

Preventing text from wrapping around an image: tips and tricks

I've been struggling to prevent text from wrapping around an image on my webpage. Despite various attempts like enclosing the image and text in separate <div> elements, setting both the <img> and <div> to display as block, and even t ...

Struggling with pagination problems in Bootstrap 4 and looking to integrate QR code functionality into your blade template?

I am currently facing an issue with generating a batch of QR codes using the SimpleQR code generator in Laravel blade template on the fly for printing. The problem arises when a page break occurs, as it breaks the QR code. I attempted to use the break-insi ...

including information inputted into a form into a data-storage system

I have set up a webform for users to request access to my CV. After submission, I aim to save their details in a phpMyAdmin database. As a PHP beginner handling databases within an HTML file, I received some code that needed modifications to fit my form fi ...

"Implementing a where clause in an AJAX request with a date range

Here is the HTML code snippet: <div class="col-md-4 input-group input-group-lg search"> <span class="input-group-addon"><i class="fa fa-fw fa fa-calendar red"></i></span> <input id="config" class="form-control ...

How to position collapsible buttons in Twitter's Bootstrap framework

I have successfully created two buttons on the same line. The second button is collapsible and when clicked, it adds a row of two more buttons to the view. However, the newly collapsed row of buttons appears aligned with the second button. I would like th ...

Encountering an issue when attempting to store image links in the database using PDO

One idea that I have is to create an image uploader system that sends the image to the 'upload' folder and saves the link to the database. I encountered errors in my 'images.php' file. Can anyone assist me with resolving these issues? ...

The thickness of an SVG line increases as it is rotated

I am working with multiple straight lines and have specified the stroke-width as 4. However, when I attempt to rotate them, the lines appear thicker than expected. Additionally, setting a negative value, such as <path d="M0 -10 20 0" stroke-width="4" st ...

What is the best way to develop a JavaScript function that divides the total width by the number of table headers (`th`)?

I recently came across this amazing scrollable table on a website, but I'm facing an issue with resizing the headers equally. Due to my lack of knowledge in JavaScript, I'm uncertain about how to tackle this problem. My intuition tells me that a ...

What is the best way to change the background color of a table cell in HTML and CSS?

Trying to adjust the background image of each data cell to a selected image has been challenging. Using the method displayed below, only the top left corner of the photo appears. The code snippet demonstrates setting the background of each data cell to th ...

Enhancing the appearance of a PHP HTML email

I scoured the web for an answer to this question and all I could find was to include the following: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; and ...

Switchable radio options

Currently, I am creating a form containing multiple options that are mutually exclusive. However, none of these options are mandatory. That is why I want to enable the user to uncheck a selected radio button by simply clicking on it again. This way, all th ...

How to customize a dropdown menu with the size property?

Can anyone help me with styling a select box that uses the size attribute? Most tutorials only cover single-item select boxes. Has anyone dealt with styling select boxes with the size attribute before? Here's an example of what I'm trying to acc ...