What is the best way to position two images side by side within a tag?

I have used two image buttons and placed them in an a tag within the same bootstrap column. However, this is how they appear:

https://i.sstatic.net/5O3bm.png

This is my code:

<body>

    <div class="backgroundImage">
        <div class="text-right p-3">
            <a href="/register-dealer " class="btn p-2"><b>{{ __('Be A Dealer') }}</b></a>
        </div>


        <div class="container mt-4 mb-4">
            <div class="row">
                <div class="col-4 col-md-4 mx-auto my-auto">
                    <img class="mw-100" src="{{ asset('storage/logo/Bujishu_logo.png') }}" alt="Bujishu">
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row mb-4">
                <div class="col-12 col-md-8 offset-md-2 text-center">
                    <h2 class="bujishu-motto">
                        A home is made of
                        <i>
                            <p class="bujishu-recursive">hopes</p>
                        </i>
                        and
                        <i>
                            <p class="bujishu-recursive">dreams</p>
                        </i>
                    </h2>
                    <h2 class="bujishu-motto">
                        Let us
                        <i>
                            <p class="bujishu-recursive">inspire</p>
                        </i>
                        you to build the perfect home!
                    </h2>
                </div>
            </div>

            <div class="row mt-4">
                <div class="col-6 col-md-4 offset-md-3 ">
                    <a href="/login " class="grad2"><img class="landing_button" src="{{ asset('storage/buttons/Login-Icon.png') }}" alt="Login"></a>
                  
                {{-- </div>

                <div class="col-6 col-md-4  "> --}}
                   
                    <a href="/register" class="grad2"><img class="landing_button"  src="{{ asset('storage/buttons/Sign-Up.png') }}" alt="Sign Up"></a>
                </div>
            </div>
        </div>

    </div>

    </div>
</body>

How can I align the next two buttons side by side with some space between them?

Answer №1

Employ the d-flex property along with a class within your col.

<div class="col-6 col-md-4 offset-md-3 d-flex">

To create space between the buttons, consider adding the pl-3 class to the SIGN UP button.

Answer №2

If you are utilizing Bootstrap 4, it will function if you employ two columns, each sized at 6 units or you can adjust the column sizes accordingly.

<body>
<div class="backgroundImage">

            <div class="text-right p-3">
                <a href="/register-dealer " class="btn p-2"><b>{{ __('Be A Dealer') }}</b></a>
            </div>


            <div class="container mt-4 mb-4">
                <div class="row">
                    <div class="col-4 col-md-4 mx-auto my-auto">
                        <img class="mw-100" src="{{ asset('storage/logo/Bujishu_logo.png') }}" alt="Bujishu">
                    </div>
                </div>
            </div>

            <div class="container">
                <div class="row mb-4">
                    <div class="col-12 col-md-8 offset-md-2 text-center">
                        <h2 class="bujishu-motto">
                            A home is made of
                            <i>
                                <p class="bujishu-recursive">hopes</p>
                            </i>
                            and
                            <i>
                                <p class="bujishu-recursive">dreams</p>
                            </i>
                        </h2>
                        <h2 class="bujishu-motto">
                            Let us
                            <i>
                                <p class="bujishu-recursive">inspire</p>
                            </i>
                            you to build the perfect home!
                        </h2>
                    </div>
                </div>

                <div class="row mt-4">
                    <div class="col-6 col-md-6">
                        <a href="/login " class="grad2"><img class="landing_button" src="{{ asset('storage/buttons/Login-Icon.png') }}" alt="Login"></a>

                    </div>

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

                        <a href="/register" class="grad2"><img class="landing_button"  src="{{ asset('storage/buttons/Login-Icon.png') }}" alt="Sign Up"></a>
                    </div>
                </div>
            </div>

        </div>
</body>

Answer №3

The row consists of about 12 columns in total, so it is recommended to use col-md-6 or add d-flex to the row itself.

<div class="row mt-4">
            <div class="col-6 col-md-6 ">
                <a href="/login " class="grad2"><img class="landing_button" src="{{ asset('storage/buttons/Login-Icon.png') }}" alt="Login"></a>

            </div>

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

                <a href="/register" class="grad2"><img class="landing_button"  src="{{ asset('storage/buttons/Sign-Up.png') }}" alt="Sign Up"></a>
            </div>
        </div>

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

Creating a personalized pop-up container similar to the style seen on YouTube

I am looking to create a popup window similar to the YouTube share feature where it sticks next to a button. I have tried using Bootstrap modal, but it opens in the middle of the screen. I want the popup to appear around the button when the YouTube share b ...

Adjust the button's hue upon clicking it

The current function is operational. Upon pressing the button, it toggles between displaying "click me" and "click me again". However, I desire the button to appear blue when showing "click me" and red when displaying "click me again". <!DOCTYPE html ...

Jquery used to create an image gallery with a zoom-in feature

Kindly review the URL provided below: I noticed that they are using flash to display a slideshow on that site. Is there a way to achieve similar image display using jquery? I have searched online but haven't found a jquery solution like that. ...

Mastering the art of utilizing Angular Routing alongside CSS grid for seamless website navigation

My <app-root> layout is pretty straightforward: app.component.ts import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.compone ...

What is the method for adding <option> tags to a <select> statement using a for loop?

Currently, I am facing a challenge in dynamically populating the <option> tags within a <select> menu. My approach involves using a for loop in JavaScript to cycle through the number of options and append them to the select tag. The part of th ...

Scroll Bar Menu (User-Controlled)

I'm looking for any libraries out there that can replicate or provide a similar horizontal scrolling menu to that of espn.com's homepage. I'm relatively new to jquery and feeling a bit lost on where to begin. I did some searching on Google, ...

Crafting a dynamic CSS 'trail' effect when hovering

I am attempting to create a visually appealing CSS menu using primarily CSS, with just a touch of jQuery as well: Here is the concept: +------------------------+ | | | | | +---+ | | | ...

What is preventing me from adding a borderRadius to this particular React bootstrap tab?

I have been working on tabbed content and encountered an issue with applying border radius. Despite adding style={{borderRadius: "10px"}}, it seems to have no effect. This styling works perfectly everywhere else in my project, so I am puzzled as ...

Arrange the div elements in a single horizontal line

Is there a way to align the company logo div next to the name, address, email, and phone number containers? I've attempted using display: inline and float: right, but the logo isn't moving up as desired. Here's the code snippet: http://jsfi ...

Alignment issue: table-cell elements are not lining up correctly

Curious as to why the containers on this page seem misaligned. Any assistance would be greatly appreciated. Thank you. http://codepen.io/anon/pen/jpmtz ...

Performing an AJAX request inside of another AJAX request

I have integrated buttons into my website that are activated by JS AJAX loads. By clicking on these buttons, a JavaScript function is executed to load the contents of a PHP file into a specific div element. This setup is crucial as I want to avoid the enti ...

Steps for showcasing the data entered in the input box

I am looking to enhance my skills in working with Angular and JavaScript. I would greatly appreciate any feedback on the issue I am facing here. My goal is for the text box input to display: "hello {name} , would you like to play a game? However, curr ...

Show Hindi content in Android web browser

I am currently developing an application that requires displaying Hindi text in an HTML format. I need to display an entire HTML page with content in Hindi. Can someone assist me with this? Any help would be greatly appreciated. Here is a snippet of my cod ...

Tips for automatically collapsing the Bootstrap 4 Sidebar on smaller devices

I am currently working on some code and have successfully hidden the sidebar using a collapse button. However, I am looking to make it collapse only for small devices, similar to how the bootstrap navbar functions. <link href="https://stackpath.boots ...

HTML SVG text elements styled with varying background shades

Looking to enhance an image by adding multiple labels with distinct background colors: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <svg version="1. ...

The Dilemma of jQuery Dragging and Resizing Clash

I have implemented the Gridster Plugin() in my project. I discovered an updated demo on Github which includes resizable functionality. To ensure compatibility with future items, I have also integrated the jQuery livequery plugin. However, I am facing an i ...

Incorporating HTML5 transitions into your website

After researching HTML5 transitions and adapting some examples, I finally achieved the desired effect. <!DOCTYPE html> <html> <head> <style> div { width: 50px; height: 50px; } div. ...

Guide to creating a parallax scrolling effect with a background image

My frustration levels have hit an all-time high after spending days attempting to troubleshoot why parallax scrolling isn't functioning for a single image on a website I'm developing. To give you some context, here's the code I've been ...

A universal setting takes precedence over Vuetify divider colors

Since upgrading Vuetify from version 1.1.9 to 1.2.3, I have encountered a strange issue where all of my dividers appear much darker than before and different from the examples in the documentation. This is how it should look: https://i.sstatic.net/GnxzV. ...

"Utilizing Wordpress to showcase a unique design for the initial blog post

I run a blog that I created offline, and I have implemented a WordPress loop that checks if the first post uses a different style than the rest of the posts. However, I am facing a problem where when I navigate to the next page (page 2), the first post st ...